Inputs
SourceObjectClassDef – to locate the object to attach the file to you must provide the classdef (Reqd.)
SourceObjectName – as above, classdef and name identifies the object to attach the file to (Reqd.)
FileClassDef – (optional) defaults to SPFDesignFile
FileName – name of the file to attach without the path. For example, myDoc1.docx (Reqd)
FileDesc – (optional) for the file metadata object
LocalDirName – (optional) local directory
LocalHostName (optiona) name of host the file is being attached from
Outputs
XFRUploadResult – contains the OBID of the file metadata. If an error occurs, then ErrorMessage is populated.
This web method allows you to attach a single file to an existing object in SmartPlant Foundation. It supports files stored in the database or in a vault. The physical file needs to be uploaded to the server using the FileUtilities.UploadFile method given the URLs provided by the GetInfoForFTPFileUpload web method.
'
' Call the upload file web method
'
Dim lstrFileNameWOutPath As String = IO.Path.GetFileName(txtFilename.Text)
'
' Now send the file to the hosts
'
If String.IsNullOrEmpty(txtLocalURL.Text) = False Then
Dim lstrURL As String = txtLocalURL.Text
lstrURL = lstrURL.Replace("swi-ppo-spflap8", "localhost")
SPF.Utilities.FileUtilities.UploadFile(lblSessionId.Text, _
lstrURL, _
txtFilename.Text, _
6000000, False)
End If
If String.IsNullOrEmpty(txtRemoteURL.Text) = False Then
Dim lstrURL As String = txtRemoteURL.Text
lstrURL = lstrURL.Replace("swi-ppo-spflap8", "localhost")
SPF.Utilities.FileUtilities.UploadFile(lblSessionId.Text, _
lstrURL, _
txtFilename.Text, _
6000000, False)
End If
'
' Now call the upload method
'
Dim lstrDir As String = IO.Path.GetDirectoryName(txtFilename.Text)
Dim lobjUploadService As New UploadService.UploadSoapClient
Dim lobjUploadResult As UploadService.XFRUploadResult = lobjUploadService.UploadFileInstruction(lblSessionId.Text, cboSourceClassDef.Text, txtSourceName.Text, txtFileClassDef.Text, lstrFileNameWOutPath, "My new file desc", lstrDir, My.Computer.Name)
lblHasBeenProcessed.Text = lobjUploadResult.RequestID