06-03-2015 07:47 AM
I am getting an Error when I try to use the DetachDocument method of the WorkviewObject.
Hyland.Unity.Document doc = unityApplication.Core.GetDocumentByID(localDocument.ID );
workviewObject.DetachDocument( doc);
The goal is to modifiy this doc and reindex it and attach the new version to the object.
Any Ideas?
Thanks in advance.
I see the following in the Diag Console:
Object reference not set to an instance of an object. Hyland.Data.DataOperation Delete
Hyland.Data.DataOperation Delete
Hyland.Core.Workview.Data.DocumentDataAccess DeleteDocument
Hyland.Core.Workview.Object DetachDocument
Hyland.Core.Workview.Services.Unity.WVObject DetachDocument
06-03-2015 11:40 AM
Hello, and thanks for posting to the OnBase Community!
It appears to me that you are retrieving a document by ID, and then detaching that document. This would only work if the document object is the same exact same document object as the document attached to the WorkView object.
The DetachDocument method is specific to removing a document that is already associated.
I would suggest instead to retrieve the document list off of the WorkView object, specify the desired document, detach that document, do your needed task, and then attach the new document.
Here is a similar snippet of what I would suggest:
//retrieve the attached documents for a specific object
Hyland.Unity.DocumentList docList = wvObj.Documents;
//qualify the document list to specify the desired document. This example would remove all documents.
foreach(Hyland.Unity.Document doc in docList)
{
args.Object.DetachDocument(doc);
}
//do stuff
//attach the new/modified document
wvObj.AttachDocument(newDocument);
06-03-2015 07:54 AM
06-03-2015 11:40 AM
Hello, and thanks for posting to the OnBase Community!
It appears to me that you are retrieving a document by ID, and then detaching that document. This would only work if the document object is the same exact same document object as the document attached to the WorkView object.
The DetachDocument method is specific to removing a document that is already associated.
I would suggest instead to retrieve the document list off of the WorkView object, specify the desired document, detach that document, do your needed task, and then attach the new document.
Here is a similar snippet of what I would suggest:
//retrieve the attached documents for a specific object
Hyland.Unity.DocumentList docList = wvObj.Documents;
//qualify the document list to specify the desired document. This example would remove all documents.
foreach(Hyland.Unity.Document doc in docList)
{
args.Object.DetachDocument(doc);
}
//do stuff
//attach the new/modified document
wvObj.AttachDocument(newDocument);
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.