Vault Customization

Reply
Mentor
amitk_189
Posts: 242
Registered: ‎12-15-2011
Message 1 of 3 (478 Views)
Accepted Solution

Conversion of File to ByteArray

478 Views, 2 Replies
01-11-2013 04:19 AM

Hello,

I know this is a silly question, but i am stuck up with conversion of file to ByteArray. Can some body please suggest me how to convert a file to ByteArray. 

 

My Problem is i have to add a file to Vault 2013 using C#. If a solution link is provided that would be help full

 

 

Rgds

Amit

You are not the first to get confused between byte[] and ByteArray.  The VaultFileBrowser sample in the SDK has an example.

 

The basic steps are:

  1. Read in the local file as a byte[].  You can do this using a System.IO.FileStream or calling System.IO.File.ReadAllBytes.
  2. Create a new ByteArray object and set the 3 properties.  For simplicity, I suggest not using compression.
  3. Pass in the ByteArray object to the Add or CheckIn function.

 

 

 

Employee
Redmond.D
Posts: 812
Registered: ‎12-12-2006
Message 2 of 3 (476 Views)

Re: Conversion of File to ByteArray

01-11-2013 04:54 AM in reply to: amitk_189

You are not the first to get confused between byte[] and ByteArray.  The VaultFileBrowser sample in the SDK has an example.

 

The basic steps are:

  1. Read in the local file as a byte[].  You can do this using a System.IO.FileStream or calling System.IO.File.ReadAllBytes.
  2. Create a new ByteArray object and set the 3 properties.  For simplicity, I suggest not using compression.
  3. Pass in the ByteArray object to the Add or CheckIn function.

 

 

 



Doug Redmond
Software Engineer
Autodesk, Inc.
http://justonesandzeros.typepad.com/

Mentor
amitk_189
Posts: 242
Registered: ‎12-15-2011
Message 3 of 3 (465 Views)

Re: Conversion of File to ByteArray

01-12-2013 07:57 AM in reply to: Redmond.D

Perfect, thanks for solution. It worked.

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.