cancel
Showing results for 
Search instead for 
Did you mean: 

How to get to documents in an objects folder?

Jonathan_Magee
Champ on-the-rise
Champ on-the-rise

I am trying to get to all of the documents that have been attached into a folder under my object. I have tried a couple things and have not had any success. I look forward to any suggestions for how to get my documents!

//this object has a folder called Attachments in it's Folders, which has 11 document types that can be linked under it

Hyland.Unity.WorkView.Object myObj = originalObj.GetRelatedObject("LinkToMyInformation"); 

//first try, returns nothing

DocumentList myDocs = myObj.Documents;

//second try, myObj.Class.DocumentFolders[0]  - .ID and .Name return the correct information, however the GetFolderByID returns null

FolderManagement folderManager = app.Core.FolderManagement;
Folder attachFolder = folderManager.GetFolderByID(myObj.Class.DocumentFolders[0].ID);
DocumentList myDocs = attachFolder.GetDocuments();

1 ACCEPTED ANSWER

Jeff_Stoner
Elite Collaborator
Elite Collaborator

Hi Jonathan -

There are a couple of different "folders" that pertain to WorkView objects and I'm not totally clear which one you are referring to but maybe the following will help.

// This returns the "static" documents attached to the object
DocumentList myDocs = myObj.Documents;

// This returns the "dynamic" folders configured for a class (e.g. the Folders folder under
// the Class within OnBase Studio).
DocumentFolderList docFolders = myObj.Class.DocumentFolders;

Unfortunately, I don't see a way to get the documents for an object from the docFolder using the Unity API - you might have to generate your own DocumentQuery.

Lastly, there are the OnBase folder types configured for a class (e.g. the Folder Types tab for Class Mappings within OnBase Studio). Unfortunately, I don't see a way to get the folder types for a class (or object) using the Unity API - you might have to generate your own FolderQuery to retrieve the folders.

Hopefully I'm missing something and there's a more direct way to obtain the information that you want.

Regards,
-jeff

View answer in original post

5 REPLIES 5

Jeff_Stoner
Elite Collaborator
Elite Collaborator

Hi Jonathan -

There are a couple of different "folders" that pertain to WorkView objects and I'm not totally clear which one you are referring to but maybe the following will help.

// This returns the "static" documents attached to the object
DocumentList myDocs = myObj.Documents;

// This returns the "dynamic" folders configured for a class (e.g. the Folders folder under
// the Class within OnBase Studio).
DocumentFolderList docFolders = myObj.Class.DocumentFolders;

Unfortunately, I don't see a way to get the documents for an object from the docFolder using the Unity API - you might have to generate your own DocumentQuery.

Lastly, there are the OnBase folder types configured for a class (e.g. the Folder Types tab for Class Mappings within OnBase Studio). Unfortunately, I don't see a way to get the folder types for a class (or object) using the Unity API - you might have to generate your own FolderQuery to retrieve the folders.

Hopefully I'm missing something and there's a more direct way to obtain the information that you want.

Regards,
-jeff

It is the second one, under the Folders folder for the class in OnBase Studio.

myObj.Class.DocumentFolders[0].ID and myObj.Class.DocumentFolders[0].Name return the correct information, however if I use the returned ID value and try to do a GetFolderByID(myObj.Class.DocumentFolders[0].ID), it returns null.

Is there a way to use that DocumentFolder ID in a document query? If so, wouldn't it return all of the documents in that folder? How would I limit it to just the ones related to the current instance of the class that I'm working with?

Thanks!

GetFolderByID is for regular OnBase folders and won't work with WorkView's "dynamic/virtual" folders.

Unfortunately, I don't see any use for the DocumentFolder ID using the Unity API. Internally, the only thing that I see it used for is to relate the document types that have been assigned to the class's folder (OnBase Studio).

I'm not very familiar with the Unity API - maybe someone else will chime in.

Ok, thanks for the info!