M-Files API 22.3.11184.0
UploadFile Method
VaultObjectFileOperations Object : UploadFile Method
The file ID number.
The version number of the file to be uploaded.
The full path of the source file to be uploaded from.
Description
Uploads the new content of the specified file to the server.
Syntax
Visual Basic
Public Sub UploadFile( _
   ByVal File As Long, _
   ByVal FileVersion As Long, _
   ByVal FilePath As String _
) 
Parameters
File
The file ID number.
FileVersion
The version number of the file to be uploaded.
FilePath
The full path of the source file to be uploaded from.
Remarks
This method is available only if M-Files API is used in the server interface mode.
Example
' Identify the target document.
Dim oObjID As New MFilesAPI.ObjID
'... 

' Check out the target document.
Dim oCheckedOutVersion As MFilesAPI.ObjectVersion
oCheckedOutVersion = oVault.ObjectOperations.CheckOut(oObjID)

' Determine the target file to be uploaded.
Dim oCheckedOutFiles As MFilesAPI.ObjectFiles
Dim oCheckedOutFile As MFilesAPI.ObjectFile
oCheckedOutFiles = oVault.ObjectFileOperations.GetFiles(oCheckedOutVersion.ObjVer)
oCheckedOutFile = oCheckedOutFiles.Item(1)

' Upload the file.
Dim szFile As String = "C:\Temp\File.pdf"
oVault.ObjectFileOperations.UploadFile(oCheckedOutFile.ID, oCheckedOutFile.FileVer.Version, szFile)

' Finalize with check-in.
oVault.ObjectOperations.CheckIn(oCheckedOutVersion.ObjVer)
See Also

VaultObjectFileOperations Object  | VaultObjectFileOperations Members