Problem updating Item Properties in VP2016

Problem updating Item Properties in VP2016

gavbath
Collaborator Collaborator
2,225 Views
3 Replies
Message 1 of 4

Problem updating Item Properties in VP2016

gavbath
Collaborator
Collaborator

I'm hoping someone may be able to help em with an issue I'm having.

In my VP2014 code, I was using the ItemService.UpdateAndCommitItem method to update user properties in an Item by passing in an array of PropInst objects.

 

With 2016, I assume that I'm supposed to do it differently, using the UpdateItemProperties method in the ItemService.

I'm confused though. The "Vault 2016 API Changes" section in the SDK documentation lists the UpdateItemProperties method as removed!

But the documentation clearly shows it in the ItemService.

 

Anyway, I get a 3933 Server error code which translates to "UpdatePropertiesFailed" and I don't know why.

 

Here's my code:

 

//First I make the item editable
editItem = this.m_itemSvc.EditItems(new long[] {item.RevId})[0];

//Then I create a list of PropInstParams
List<PropInstParam> propInstParams = new List<PropInstParam>();
                foreach (Property property in properties)
                {
                    PropInstParam propInstPar = new PropInstParam();
                    propInstPar.PropDefId = property.PropDefId;
                    propInstPar.Val = property.Value;
                    propInstParams.Add(propInstPar);
                }

//Convert to the required array of arrays
PropInstParamArray propInstParamsArray = new PropInstParamArray();
                propInstParamsArray.Items = propInstParams.ToArray();

                PropInstParamArray[] propInstParamsArrays = new PropInstParamArray[1];
                propInstParamsArrays[0] = propInstParamsArray;

//And finally, try to update the properties
Item[] updatedItems = this.m_itemSvc.UpdateItemProperties(new long[] { editItem.RevId }, propInstParamsArrays);

And the last line is where the exception is thrown.

 

Anyone got any ideas?

Gavin Bath
MFG / CAM Technical Specialist
Design and Motion Blog
Facebook | Twitter | LinkedIn | YouTube


   

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

gavbath
Collaborator
Collaborator
Accepted solution

I just read this: http://forums.autodesk.com/t5/vault-customization/update-description-item-co-item-property-does-not-...

 

Even though the error code was incorrect, it's the same error message.

 

I will go back and check if I may have accidentally included system properties in the update, rather than just UDPs.

That may be my issue.

 

I'll report back.

Gavin Bath
MFG / CAM Technical Specialist
Design and Motion Blog
Facebook | Twitter | LinkedIn | YouTube


   

Message 3 of 4

gavbath
Collaborator
Collaborator
That was it! I accidentally had included a system property in my array. It can only handle UDPs. Hope this helps someone else.

Gavin Bath
MFG / CAM Technical Specialist
Design and Motion Blog
Facebook | Twitter | LinkedIn | YouTube


   

Message 4 of 4

gumar-amcad
Contributor
Contributor

Hi.
All fields are blocked at the moment when the document on editing, and at the time of return of the document to Vault.
Therefore it is impossible to bring value!!!

0 Likes