string filepath1 = @“C:\Aras\filename1.txt”;
string filepath2 = @“C:\Aras\filename2.txt”;
In terms of uploading multiple files, is there a particular reason you are creating File items directly like this? Typically, I would expect these files to be related to a Document or another ItemType. If you relate these Files to an item instead, you can upload multiple files using the sample below.
Item doc = inn.newItem("Document", "add");
doc.setProperty("item_number", "My doc");
//First file
Item docFile = doc.createRelationship("Document File", "add");
docFile.setFileProperty("related_id", filepath1);
// Second file
Item docFile2 = doc.createRelationship("Document File", "add");
docFile2.setFileProperty("related_id", filepath2);
// Apply
return doc.apply();
If you need to upload these as File items without containers, I would recommend using the CheckinManager class which was built for this kind of use case. You can see an example of using this class below.
Item fileUpload = inn.newItem("tmp");
// File 1
Item file1 = inn.newItem("File", "add");
file1.setProperty("filename", "filename1.txt");
file1.setProperty("actual_filename", filepath1);
file1.setProperty("checkedout_path", @"C:\Aras");
Item located = file1.createRelationship("Located", "add");
located.setProperty("related_id", "67BBB9204FE84A8981ED8313049BA06C"); // default vault
fileUpload.appendItem(file1);
// File 2
Item file2 = inn.newItem("File", "add");
file2.setProperty("filename", "filename2.txt");
file2.setProperty("actual_filename", filepath2);
file2.setProperty("checkedout_path", @"C:\Aras");
Item located2 = file2.createRelationship("Located", "add");
located2.setProperty("related_id", "67BBB9204FE84A8981ED8313049BA06C"); // default vault
fileUpload.appendItem(file2);
// Apply
fileUpload.removeItem(fileUpload.getItemByIndex(0));
IomFactory factory = new IomFactory();
Aras.IOME.CheckinManager cm = factory.CreateCheckinManager(fileUpload);
return cm.Checkin(1);
Chris
Looking to adapt this for uploading from 20 to 1000 files as we migrate from the older PLM Systems to Aras
Examples I've seen require "related_id" leading me to believe this would be a two-step process.
Batch load document information, pull "related_id" and then build .cs to upload physical file (.pdf)
Does Aras facilitate the multi-file upload/migration? Is there an admin tool to address this?
Looking to adapt this for uploading from 20 to 1000 files as we migrate from the older PLM Systems to Aras
Examples I've seen require "related_id" leading me to believe this would be a two-step process.
Batch load document information, pull "related_id" and then build .cs to upload physical file (.pdf)
Does Aras facilitate the multi-file upload/migration? Is there an admin tool to address this?