Autodesk Vault Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Here is a working Windows login to vault but how do i ensure a right logout
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I played around with the listfiles example in the Vault sdk and struggled, like a lot of others i think. With getting the windows login to work. i made it at an inventor addin and here is what worked for me. but how do i ensure a proper logout? any help appreciated
regards.
kent boettger
Private Const HOST As String = "srv-pdm" '"localhost"
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
'RunCommandNormalLogin(HOST)
RunCommandWinLogin(HOST)
End Sub
Public Sub RunCommandWinLogin(ByVal serverName As String)
'Login with Windows User login
Dim winAuthSvc As WinAuthService = New WinAuthService()
winAuthSvc.Url = "http://" + serverName + "/AutodeskDM/Services/WinAuth/WinAuthService.asmx"
winAuthSvc.UseDefaultCredentials = True
winAuthSvc.SecurityHeaderValue = New WinAuthSvc.SecurityHeader()
winAuthSvc.SignIn("Vault")
Dim docSrv As DocumentService = New DocumentService()
docSrv.SecurityHeaderValue = New Autodesk.Connectivity.WebServices.DocumentSvc.Secu rityHeader()
docSrv.SecurityHeaderValue.UserId = WinAuthSvc.SecurityHeaderValue.UserId
docSrv.SecurityHeaderValue.Ticket = WinAuthSvc.SecurityHeaderValue.Ticket
docSrv.Url = "http://" + serverName + "/AutodeskDM/Services/DocumentService.asmx"
Dim login As WinAuthCredentials = New WinAuthCredentials(serverName, "Vault")
Using serviceManager As New WebServiceManager(login)
Try
Dim root As Folder = docSrv.GetFolderRoot()
Me.m_listBox.Items.Clear()
PrintFilesInFolder(root, docSrv)
Catch ex As Exception
MessageBox.Show(ex.ToString(), "Error")
End Try
End Using
End Sub
Re: Here is a working Windows login to vault but how do i ensure a right logout
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
The WebServiceManager will log out for you when the USING block exists. This article explains things more.
I apologize. The VB version of VaultList could have been written better. In fact, you can remove about half the code in your RunCommandWinLogin. Everything before "Dim login as WinAuthCredentials" can be removed.
For the next SDK release, we cleaned it up a bit to look like this...
Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
ListAllFiles()
End Sub
''' <summary>
''' This function lists all the files in the Vault and displays them in the form's ListBox.
''' </summary>
Public Sub ListAllFiles()
' Set up the login credentials for Vault.
' For demonstration purposes, the information is hard-coded.
Dim login As New UserPasswordCredentials("localhost", "Vault", "Administrator", "", _
True) ' log in as read-only, which doesn't consume a license
' Create the WebServiceManager which can be used for all Vault Server calls.
' Putting the manager in a using block insures that it logs out when we are done.
Using serviceManager As New WebServiceManager(login)
Try
' Start at the root Folder.
Dim root As Folder = serviceManager.DocumentService.GetFolderRoot()
Me.m_listBox.Items.Clear()
' Call a function which prints all files in a Folder and sub-Folders.
PrintFilesInFolder(root, serviceManager)
Catch ex As Exception
MessageBox.Show(ex.ToString(), "Error")
Return
End Try
End Using
End Sub


