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

Aki_Daiguji
Star Contributor
Star Contributor

Hi Jonathan,

Unfortunately, as you and Jeff have already mentioned, we currently cannot get documents from the dynamic WorkView folders from the folders themselves.

However, if you are using a configured Keyword Type Map for your WorkView folder, you can get the Keyword Type Map that is associated to your Class, and get each of the Keyword mappings (Attribute to Keyword mapping) for that Keyword Type Map. Based on this, you can know which Attribute value on the WorkView object in question will equate to which Keyword value, and perform a document query based on those information.

On the Class object, calling the Class.KeytypeMaps property will give you a list of KeytypeMap objects. On the KeytypeMap object, calling the KeytypeMap.Keytypes property will give you a list of Keytype objects. The Keytype object will give you the Attribute (in the form of an address) and Keyword (in the form of Keyword ID), and the value associated with the KeytypeMap. Unfortunately DocumentType is not returned if you are using a Document Type based query for your folder logic, so you may need to hard code that into your code.