infoRouter Document Management System - Web Services API Documentation Version 7.0
UploadDocument
Uploads a new document or creates a new version of an existing document in byte array format to the specified path.
Syntax
[Visual Basic]
Public Shared Function UploadDocument(ByVal AuthenticationTicket As String, _
ByVal Path As String, _
ByVal FileContent As Byte(), _
ByVal VersionComment As String, _
) as xmldocument
Parameters

AuthenticationTicket

infoRouter Authentication Ticket

Path

An infoRouter document path

FileContent

The Content of the file. The Content must be in the format of the byte array.

VersionComment

The comments of the author for the uploaded document.


Return Value
returns xml fragment.
<response success="true" error="">
if success = "true", the document has been uploaded.
if success = "false", the error attribute returns the error description.
Remarks
The caller must have at least "Add" permissions on the folder.

If the specified path does not exist, the path will be created.

If a document with the same name already exists in the same path, a new version of the existing document will be created.
Example
Public Sub UploadDocument_Sample()

Const IRAuthenticationTicket As String = "sid-xxxxxxxxxxxxxxx"

Const IRServerPath As String = "/public/sample/"
Const LocalFilePath As String = "c:\temp\SummerPlan.doc"
Const VersionComments As String = ""

Dim IROBJ As InfoRouter.srv

Try
If System.IO.File.Exists(LocalFilePath) Then
Dim FileName As String = System.IO.Path.GetFileName(LocalFilePath)
Dim buffer() As Byte
IROBJ = New InfoRouter.srv

'create byte array to upload
Dim fs As System.io.FileStream = New System.io.FileStream( _
LocalFilePath, _
System.IO.FileMode.Open, _
System.IO.FileAccess.Read)

'create a BinaryReader
Dim br As System.io.BinaryReader = New System.io.BinaryReader(fs)

buffer = br.ReadBytes(fs.Length)
br.Close()
fs.Close()
br = Nothing
fs = Nothing

'call upload method
Dim xml_response As System.Xml.XmlElement
xml_response = IROBJ.UploadDocument(IRAuthenticationTicket, _
IRServerPath & FileName, _
buffer, _
VersionComments)

'check response xml if any error occured.
If xml_response.GetAttribute("success") = "true" Then
Console.WriteLine("The Document has been uploaded successfully")
Else
Console.WriteLine("The Document cannot be uploaded.")
Console.WriteLine(xml_response.GetAttribute("error"))
End If
xml_response = Nothing
Else
Console.WriteLine("Local file not found.")
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
IROBJ = Nothing
End Try
End Sub
See Also
Download Document | Lock | UnLock | Delete Document
Web Services API Syntax based on infoRouter Document Management System Version 7.0
Copyright() 1998-2008 Active Innovations, Inc.
infoRouter Document Management Software