Community
Vault Forum
Welcome to Autodesk’s Vault Forums. Share your knowledge, ask questions, and explore popular Vault topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Switching between primary and secondary link files of item

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
714 Views, 2 Replies

Switching between primary and secondary link files of item

Hi,

 

I need to add some file as secondary link to an item. Item doesn't have any file links. When I use ReassignComponentsToDifferentItems (ItemService) example, I add file and it becomes PRIMARY link (if an item had already primary file link [but mine doesn't have], the just added one will became secondary file link). And now I want use the following method to switch just added PRIMARY link file to SECONDARY link file:

 

Item UpdateAndCommitItem (
    Item rev,
    Long primary,
    Long [] secondary,
    Long [] stdComp,
    Attmt [] Attachments,
    PropInst [] UserDefinedProperties,
    Integer activeInputs
);

 

So I am invoking:

 

itemService.UpdateAndCommitItem(latestItem, primaryFileId, new[] { primaryFileId }, null, null, null, 1);

 

 

ValueMeaning
1'secondary' field is active.
2'Attachments' field is active.
4'UserDefinedProperties' field is active.

 

And I still get an error:

1387RestrictionsOccurred

 

What am I doing wrong???? Please help me !!! I have no idea what to do with that 😕

 

Thanks in advance for any suggestions,

Mike

 

2 REPLIES 2
Message 2 of 3
jackywen
in reply to: Anonymous

Hello Mike, did you call the ItemService.EditItem(...) API before you call UpdateAndCommitItem? The item must be editable before it is updated. If you did, could you post the detail restriction message?

 

Regards,

Jacky

Message 3 of 3
Anonymous
in reply to: jackywen

Hi Jacky,

 

You are my Hero ! 🙂 Thanks a lot... when EditItem is invoked first, it is working now. I need to keep in mind that there is some common flow for editing items... first mark to edit and then update and commit. On the other hand there could be some meaning ful exception for that - not only 1387 - RestrictionsOccurred.

 

You wrote that I could provide detail restriction message... is it possbile to get such message after getting only plain exception (in this case with number 1387)?

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

Post to forums  

Autodesk Design & Make Report