Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UpdateFileProperties problems

3 REPLIES 3
Reply
Message 1 of 4
Micky_SDP
1000 Views, 3 Replies

UpdateFileProperties problems

Hi all,

I've a problem with the UpdateFileProperties function.

This function work correctly if a file in CheckedOut.

 

In my customization I would do the following steps:

1) Update in Vault my file with the functuion UploadFilePart and AddUploadedFile (it's the first time). After these functions the file is CheckedIn.

2) UpdateFileProperties on this file (in this moment UpdateFileProperties fail)

 

Is there a solution or a work around to my problem? 

 

Thank's 

Michele

3 REPLIES 3
Message 2 of 4
orbjeff
in reply to: Micky_SDP

Hi there - You have two options for updating properties in Vault:

 

//Option 1: Programmatically check out the file, update properties and check the file //back in

m_serviceManager.DocumentService.CheckoutFile(vaultedfile.EntityIterationId,
                                                Autodesk.Connectivity.WebServices.CheckoutFileOptions.Master, Environment.MachineName, localFile.FullName, "Update file properties", out byteArray);

//Build your property definition id and property definition values arrays here

m_serviceManager.DocumentService.UpdateFileProperties(new long[] { fileMasterId }, updatePropDefIds.ToArray(), updatePropDefValues.ToArray());

//Notice the fileAssocArray that should be captured and used on check in or the file will be checked back into Vault without any file associations.

m_connManager.FileManager.CheckinFile(vaultedfile, "Updated file properties”, false, fileAssocArray.ToArray(), null, false, null, Autodesk.Connectivity.WebServices.FileClassification.DesignDocument, false, filepathAbsolute);

//Option 2: Use the “IExplorerUtil” to update properties

//This option does not require you to check the drawings out first.

public void OnLogOn(IApplication application)
{
iExplorerUtil = ExplorerLoader.GetExplorerUtil(application);
}

Dictionary<PropDef, object> propsDictionary = new Dictionary<PropDef, object>();
PropDef[] propDefFileInfoArray = m_serviceManager.PropertyService.GetPropertyDefinitionsByEntityClassId("FILE");
PropDef propDef = null;
propDef = propDefFileInfoArray.First(n => n.Id == (long)”<prop id to be updated>”);
propsDictionary.Add(propDef, "Test Entry");
iExplorerUtil.UpdateFileProperties(maxFile, propsDictionary);

 

Both options are better documented in the VaultSDKXXX.chm file and on Doug Redmonds blog http://justonesandzeros.typepad.com/

Jeff Johnson
Technical Consultant
MasterGraphics Inc.
Message 3 of 4
Micky_SDP
in reply to: orbjeff

Thank's Jeff..

I try to use iExplorerUtil.UpdateFileProperties but call an Exception.

 

I think there is a problem with 64 bit system. I try to use x86 compiler configuration but it's the same.

 

Have you any idea?

 

Thank's

Michele

Message 4 of 4
minkd
in reply to: Micky_SDP

Your application needs to checkout the file before it can call the DocumentService.UpdateFileProperties method, and it should checkin the file afterwards. Downloading & uploading the file is optional. There is no way around the checkout/checkin.

 

The iExplorerUtil.UpdateFileProperties will do the checkout & download for you (it may only do this if it isn't already checked-out/downloaded), and it definitely does the upload & checkin afterwards.  In between it is not only updating file UDPs, but it also gets any mapped properties from the server and writes those into the file before uploading it.

 

If you are looking to "sync properties" with the server then the iExplorerUtil.UpdateFileProperties is probably the way to go.

 

However, if you are just trying to edit some property values, then it is way overkill.  Worst case is you change a value that is mapped back to content source property, which results in the file having property compliance warnings until the write-back occurs.

 

-Dave

 



Dave Mink
Fusion Lifecycle
Autodesk, Inc.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report