cancel
Showing results for 
Search instead for 
Did you mean: 

Updating Document Date via Unity API

Anthony_Boyd
Star Collaborator
Star Collaborator

Is there a way to update the document date for an already existing document using the Unity API?  I looked through the SDK and could not find a way and when I tried using the .DocumentDate property of the document but this appers to be read-only.  I have a vbScript that can do this but would rather use a Unity script.

Thanks

Anthony

4 REPLIES 4

Lois_Nowak
Confirmed Champ
Confirmed Champ

This functionality will be available in the 12.0 release of the Unity API.

 

What is the Unity API call in 12.0 to do this?

Shane_Cook
Star Contributor
Star Contributor

As you already noted, the DocumentDate property on the document object is read-only.  To change that property or any other document property (like most document update functions) requires a "modifier".  I did not find any example in the current SDK, so I will request that be added in an upcoming edition of the SDK.

Here is a simple Unity API example that sets the document date to today's date:

  1. Document doc = args.Document;

  2. DocumentPropertiesModifier docMod = doc.CreateDocumentPropertiesModifier();

  3. docMod.DocumentDate = DateTime.Now.Date;

  4. docMod.ApplyChanges();

 

We tried:

var document = unityCore.GetDocumentByID(xxxx);

 

            using (var lockDoc = document.LockDocument())

            {

               if (lockDoc.Status.Equals(DocumentLockStatus.LockObtained))

               {

                  Console.WriteLine(@"Document Locked.");

                  using (lockDoc)

                  {

                     var t = document.CreateDocumentPropertiesModifier();

                     t.DocumentDate = DateTime.Now;

                     t.ApplyChanges();

                  }

               }

            }

however it results in an exception when the changes are applied. 

Document Locked.

Hyland.Unity.UnityAPIException: An error occurred within the Unity API: Failed t

o verify id file for platter (2) 179:8:1 at: '\\SanitizedServerName\Nautilus_T_DG\DG

33\DIP_Processes\NAUTILUS.ID'

   at Hyland.Unity.Application.Validate(Response response)

   at Hyland.Unity.Application.ExecuteWithValidation(Request request)

   at Hyland.Unity.DocumentPropertiesModifier.ApplyChanges()

   at Nautilus.Program.Main(String[] a_args) in d:\Solution Files\Nautilus\Nauti

lus\Program.cs:line 37

---------------------

Server Source: Hyland.Core

Server TargetSite: System.String MountPlatter(Hyland.Core.PlatterManagement.PmCo

ntext, Hyland.Core.PlatterManagement.PhysicalPlatter, Hyland.Core.PlatterManagem

ent.FileAccessImpl, Hyland.Core.PlatterManagement.DiskgroupAliasList)

Server Exception: Failed to verify id file for platter (2) 179:8:1 at: '\\SanitizedServerName\Nautilus_T_DG\DG33\DIP_Processes\NAUTILUS.ID' --->    at Hyland.Core.P

latterManagement.Utility.MountPlatter(PmContext pmContext, PhysicalPlatter platt

er, FileAccessImpl fileAccess, DiskgroupAliasList aliases)

   at Hyland.Core.PlatterManagement.Commit.CommitPage(DocumentPage page, Boolean

bForceOverwrite)

   at Hyland.Core.PlatterManagement.Commit.CommitDocument(Document document, Boo

lean bForceOverwrite)

   at Hyland.Core.PlatterManagement.Archival.CommitDocument(Document document, B

oolean bForceOverwrite)

   at Hyland.Core.PlatterManagement.Archival.CommitDocument(Document document)

   at Hyland.Core.DocumentArchiver.StoreDocument(Document document, DocumentStor

ageProperties properties)

   at Hyland.Core.Unity.Services.DocumentService.applyPropertyChanges()

Getting started

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.