[Vault2016] UpdateFileProperty

[Vault2016] UpdateFileProperty

Anonymous
Not applicable
1,364 Views
3 Replies
Message 1 of 4

[Vault2016] UpdateFileProperty

Anonymous
Not applicable

Hey,

 

in this code there no Error, but i dosent can see the Property in File???

 

  • checkout the file
  • update the file
  • check inthe file

 

no changes to see in Vault on the Propertys

 

 

            PropInstParamArray[] oPropInstParamArray = new PropInstParamArray[] { new PropInstParamArray { Items = new PropInstParam[] { new PropInstParam {
	            PropDefId = wecVaultTools.Modules.wecVaultTools.getFilePropDefIdByPropertyName(false, "Firma"),
	            Val = "Test Mario"
            } } } };



            File oclsFile = clsGlobal.oDocSvc.GetLatestFileByMasterId(e.FileMasterId);
             

            try
            {
                ByteArray oByteArray;
                File oVaultFile = clsGlobal.oDocSvc.CheckoutFile(oclsFile.Id, CheckoutFileOptions.Master, Environment.MachineName, @"c:\\test\\", @"PropUpdate", out oByteArray);

                clsGlobal.oDocSvc.UpdateFileProperties(new long[] { e.FileMasterId }, oPropInstParamArray);

                FileAssocArray oFileAssocArray = clsGlobal.oDocSvc.GetFileAssociationsByIds(new long[] { oclsFile.Id }, FileAssociationTypeEnum.All, false, FileAssociationTypeEnum.All, false, true, true).First();
                oVaultFile = clsGlobal.oDocSvc.CheckinUploadedFile(oVaultFile.MasterId, "test Property", false, System.DateTime.Now, oFileAssocArray., null, false, oVaultFile.Name, oVaultFile.FileClass, oVaultFile.Hidden, null);

            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }

 

thx

 

Mario

0 Likes
Accepted solutions (1)
1,365 Views
3 Replies
Replies (3)
Message 2 of 4

wayne.brill
Collaborator
Collaborator

Hi Mario,

 

Is the property a mapped property? If so, please see this post:

 

http://adndevblog.typepad.com/manufacturing/2013/07/vault-2014-iexplorerutil-vb-example.html

 

Thanks,

Wayne

 

 



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 4

Anonymous
Not applicable

Hey,

 

thx for the Answer but with the Vault 2016 looks diffrent? 

how i can handel this with this Version?

 

thx

 

Mario

0 Likes
Message 4 of 4

Anonymous
Not applicable
Accepted solution

Found a Vault2016 Solution

 

 

 

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);
0 Likes