Add File to Vault 2014

Add File to Vault 2014

amitnkukanur
Collaborator Collaborator
1,608 Views
3 Replies
Message 1 of 4

Add File to Vault 2014

amitnkukanur
Collaborator
Collaborator

Hello,

 

I am trying to add a file to Vault Professional 2014 using C# as development language. This is my below section of code. Though the code does not produce any error but still i am getting exception SOAP Exception 8000.

 

Can some body please suggest me where am i going wrong..

 

 

using (FileStream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
ByteArray fileData = new ByteArray();
fileData.Bytes = new byte[stream.Length];
stream.Read(fileData.Bytes, 0, fileData.Bytes.Length);
mgr.DocumentService.AddUploadedFile(Folder2,System.IO.Path.GetFileName(filePath), "", System.IO.File.GetLastWriteTime(filePath), null, null, FileClassification.None, false, fileData);
}

 

 

Senior Software Engineer
0 Likes
Accepted solutions (1)
1,609 Views
3 Replies
Replies (3)
Message 2 of 4

minkd
Alumni
Alumni
0 Likes
Message 3 of 4

Redmond.D
Autodesk
Autodesk
Accepted solution

The easy way of doing it is to use Connection.FileManager.AddFile()



Doug Redmond
Software Engineer
Autodesk, Inc.

0 Likes
Message 4 of 4

amitnkukanur
Collaborator
Collaborator

Thank you Dave for providing a link to add file i will surely use this for other projects.

Thanks for your reply.

 

 

Thank you Doug, for providing solution. Actually the concept which you explained worked in my case as we were instructed not to cross 'N' number of lines in code hence i used connection.filemanager.addfile.

 

 

Thank you Doug, Thank you Dave for providing guidance.

 

 

rgds

Amit

 

Senior Software Engineer
0 Likes