Vault API - Add new version of file and revise

Vault API - Add new version of file and revise

Anonymous
Not applicable
2,920 Views
3 Replies
Message 1 of 4

Vault API - Add new version of file and revise

Anonymous
Not applicable

Hello,

 

I am migrating documents from an old Vault-like application into Vault.

I have various files representing the versions of a certain document, let's call it TEST.dwg, where the revised versions are 0.2, A.2 and B. So, I have three TEST.dwg files, seperated in folders like: 0.2\TEST.dwg; A.2\TEST.dwg; B\TEST.dwg.

The Vault is already configured to accept this numbering scheme.

 

In Vault, I have created the folders and added the TEST.dwg file successfully (from version 0.2), using the AddFile function.

Naturally, everytime I try to add another version I get the Server Error 1008 indicating the file already exists.

But, things become tricky now that I want to add the other files, corresponding to the other versions.

In the end, I need to be in a state where the document needs the three revisions, corresponding to those three versions of the file.

 

Made some research in the API SDK documentation but found nothing indicating adding a file as a new version or revision (it'd be quicker if I could set as revised right after adding).

I have thought the following solution:

- Checkout to Workspace;

- Copy and replace the new .dwg;

- Check in again.

Don't know if this is also possible through the API.

 

But, I was looking for a more direct solution, since I need to migrate 40k documents or so.

 

Thank you in advance.

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

Redmond.D
Autodesk
Autodesk
Accepted solution

Upload and "set revision" are separate operations, you can't do them both at once.  The API function for setting the revision is DocumentServiceExtensions.UpdateFileLifeCycleDefinitions( ).

As for uploading new file versions, the workflow you described should work fine.  You always have to check out first before uploading a new version.  You can skip the copy step if you want since the CheckinFile function lets you upload from anywhere on disk.

 

Lastly, we have a discussion group specifically for Vault API questions:  http://forums.autodesk.com/t5/vault-customization/bd-p/301

So that's the ideal place to go next time you have questions like this.

 



Doug Redmond
Software Engineer
Autodesk, Inc.

0 Likes
Message 3 of 4

Anonymous
Not applicable
Thank you, that worked perfecly.
And sorry for posting in the wrong section, Vault Customization seemed as Vault Explorer customization only.
0 Likes
Message 4 of 4

m.den.ouden
Advocate
Advocate

You can alse delete the file(s) first from vault then add again and then change the revision. 

0 Likes