How to create a copy of File in Vault?

rated by 0 users
This post has 4 Replies | 1 Follower

Top 500 Contributor
Posts 2
Points 55
Amdinside Li Posted: Tue, Aug 18 2009 2:26 AM

Hi All,

Do you know how to make a copy of existing file in Vault, so that I can attach the duplicated file to another document in Aras? The IOM API seems mainly operate on items and their relationships but not on the physical objects in vault?

Thanks.

Amdinside

 

Not Ranked
Posts 1
Points 5

yes, I am agreeing to the answer.  Duplicating file is not correct idea. It should be link to the file to other vault.

Attaching tags takes very long time!!!

Thanks.

Vijay Prabhu

 

Top 75 Contributor
Posts 18
Points 280
Sean replied on Tue, Aug 18 2009 9:41 AM

Amdinside,

I have previously created some sample code (C# Server Method) to do this as an onBeforeAdd server event for an ECR that added a copy of a spreadsheet to the ECR File relationship.  You should be able to use this code to accomplish what you want

Innovator inn = this.getInnovator();
Item myFile = inn.newItem("File","copyAsNew");
myFile.setAttribute("id","5CCBEBA08899438C967EEA3A79620D43"
);
Item myFileRel = inn.newItem("ECR File","add"
);
myFileRel.
setRelatedItem(myFile);
this
.addRelationship(myFileRel);
return
this;

Note the ID value being used is that of the file you are trying to copy.

Hope this helps

Sean

  • | Post Points: 20
Top 50 Contributor
Posts 36
Points 475

I agree with Sean; small note though - if by some reason you need to do all your processing on client then the best approach would be:

- check out the original file into your working directory

- make a copy of it (it's probably a good idea to give another name to the copied file; otherwise old file and new file might overwrite each other when both of them are checked out at the same time to the working directory)

- attach the copied file to your item (which you call "another document" in your question) using IOM.Item.attachPhysicalFile(...)

- call IOM.Item.apply() on the item to which the new file is attached

  • | Post Points: 5
Top 500 Contributor
Posts 2
Points 55

Hi Sean,

The action "copyAsNew" solved my question. It make a copy of not only the file item, but also the physical file. Thank you very much.

However I don't know where to find such kind of pre-defined action. I didn't see "copyAsNew" in any document including the programmer's guide and  and API reference.

Is there any other similar built-in actions available in Aras? For example, if I want to physically change the file name in the Vault, what should I do? I have tried to use "update" and set the new file name in file's property, but it doesn't work. The file's name only changed in database, not in vault.

Li

  • | Post Points: 5
Page 1 of 1 (5 items) | RSS