Forum Discussion

Former_Member's avatar
Former_Member
Ideator I
9 years ago

Does ARAS server need access to the file for Item.attachPhysicalFile to work?

We are using a cloud version of ARAS, and I am trying to attach a physical CAD file to an item. But I am receiving the exception:

Item is not of type 'File'.
I have verified the existence of the file, and the path is in UNC format, so I am wondering if the server needs physical access to the file for verification.

at Aras.IOM.Item.CheckThatTypeOfItemIsFile() in d:\Builds\Innovator.Builds\6296-Innovator-RELS11-0-SP5\Innovator\CompilableCode\IOM.NET\Item.common.cs:line 5359
at Aras.IOM.Item.attachPhysicalFileInternal(String filePath, String vaultServerId) in d:\Builds\Innovator.Builds\6296-Innovator-RELS11-0-SP5\Innovator\CompilableCode\IOM.NET\Item.common.cs:line 5234
at Aras.IOM.Item.attachPhysicalFile(String filePath) in d:\Builds\Innovator.Builds\6296-Innovator-RELS11-0-SP5\Innovator\CompilableCode\IOM.NET\Item.common.cs:line 5173
at ARASImport.frmImportPLM.UploadPartDocuments(Item part) in c:\code\frmImportPLM.cs:line 1504

2 Replies

  • Hi, if used server side, yes it needs to have access. (typically used to consume a file already on the server) attachPhysicalFile as a client method will be run by the browser, take the file on the client PC and upload it then.
  • Yoann thank you for the reply, but I seem to be experiencing different behavior than what you stated. The debug information shown above is from a client application using the IOM.dll
    
    if (!Directory.Exists(fileDir))
    {
    log.Warn(string.Format("Drawing directory: {0} doesn't exist", fileDir));
    continue;
    //throw new Exception(string.Format("Drawing directory: {0} doesn't exist", fileDir));
    }
    
    string[] drawingFiles = Directory.GetFiles(fileDir, drawingNumber + "*.dwg", SearchOption.TopDirectoryOnly);
    
    bool isNew = true;
    
    foreach (var cadfile in drawingFiles)
    {
    // create our cad document object and set some properties
    //
    Item cadDocument = _innovator.newItem("CAD", "add");
    
    string filename = System.IO.Path.GetFileNameWithoutExtension(cadfile);
    
    cadDocument.attachPhysicalFile(cadfile);
    
    The attachPhysicalFile call throws the exception listed in the original post. It's the validation routine at the server that fails, I thought the attachPhysicalFile would stream the file to the server from the client, but it doesn't appear to be that way.