Thanks Gavin, here is my function...
Friend Function CheckInFile(FilePath As String, FileName As String, ByRef ErrorMsg As String) As Boolean
'Login result (Username and password are ignored for WinAuth connections).
Dim authFlag As VDF.Vault.Currency.Connections.AuthenticationFlags = VDF.Vault.Currency.Connections.AuthenticationFlags.WindowsAuthentication
Dim LoginResult As VDF.Vault.Results.LogInResult = VDF.Vault.Library.ConnectionManager.LogIn(ServerName, VaultName, vbNull, vbNull, authFlag, Nothing)
If Not LoginResult.Success Then
ErrorMsg = "Unsuccessful Login to Vault."
Return False
Exit Function
End If
'Connection.
Dim connection As VDF.Vault.Currency.Connections.Connection = LoginResult.Connection
'Document Service
Dim DocServ As ACW.DocumentService = New ACW.DocumentService
'Paths.
Dim LocalPath As String = "C:\Vault Workspace\Project\Gym Equipment CAD\Orders\"
Dim VaultPath As String = LocalPath.Replace("C:\Vault Workspace\", "$\")
'Do I need to do this?
'Replace the backslashes with forward slashes.
VaultPath = VaultPath.Replace("\", "/")
Dim aFolder As ACW.Folder = Nothing
Try
'This is the line which errors...
aFolder = DocServ.GetFolderByPath(VaultPath)
Catch ex As Exception
ErrorMsg = "Error with the GetFolderByPath() method. The path is: " & VaultPath & "." & vbCrLf & vbCrLf & ex.ToString
Return False
Exit Function
End Try
Dim ParentFolder As VDF.Vault.Currency.Entities.Folder = New VDF.Vault.Currency.Entities.Folder(connection, aFolder) ' New Autodesk.Connectivity.WebServices.Folder)
Try
Using stream As New FileStream(FilePath & FileName, FileMode.Open, FileAccess.Read)
connection.FileManager.AddFile(ParentFolder, FilePath & FileName, "Added by automation.", DateTime.Now, Nothing, Nothing, ACW.FileClassification.None, False, stream)
End Using
Catch ex As Exception
ErrorMsg = "Error trying to check in " & FileName & " to vault." & vbCrLf & vbCrLf & ex.ToString
Return False
Exit Function
End Try
Return True
End Function
Here is the error I'm getting...
System.Net.WebException: The request failed with HTTP status 404: Not Found.
Thanks again!
Larry Daubenspeck
Software Programmer
Draper, Inc.