upload a simple file to vault

Hi everyone,

I try to make an app with aras.iom by C#. I want to upload a file to vault with code:

...

Item item_File_thumb = this.inn.newItem("File", "add");
item_File_thumb.setProperty("filename", myFilename);
item_File_thumb.attachPhysicalFile(myFilepath);

Item item_File_thumb_result = item_File_thumb.apply();

...

My app is stuck at apply() so it's not return any error.

Then, I try another way:

...

Item item_File_thumb = inn.newItem("File", "add");
item_File_thumb.setProperty("filename", myFilename);
item_File_thumb.setProperty("actual_filename", myFilePath);
item_File_thumb.setProperty("checkedout_path", myDir);
Item located = item_File_thumb.createRelationship("Located", "add");
located.setProperty("related_id", "67BBB9204FE84A8981ED8313049BA06C"); // default vault

IomFactory factory = new IomFactory();
Aras.IOME.CheckinManager cm = factory.CreateCheckinManager(item_File_thumb);
Item result = cm.Checkin(1);

...

but it still not working. After Checkin(), everything is paused. because no return error so I do not know what's wrong.

Pls, help.

Parents
  • Is your path correct? Do you have changed the permission in your server folder so Innovator can access the folder (if you don´t use a codetree location)?

    string fileString = "bestfileever.txt";
    string path = @"C:\\temp\\Aras\\test\\" + fileString;

    Item fileItem = inn.newItem("File", "add");

    fileItem.setProperty("filename", fileString);
    fileItem.attachPhysicalFile(path);
    Item checkin_result = fileItem.apply();

    if (checkin_result.isError()){
    inn.newError("Error" + checkin_result.getErrorDetail());
    }

  • I sure my path is correct.

    The "server folder", your mean is the VAULT FOLDER on server? The VAULT FOLDER is read only by default, I do not edit anything.

    I can create new File (TOC > File Handling) by manual, so i think the permission for File item is enough.

Reply Children
No Data