API Refresh vault status for all open documents

API Refresh vault status for all open documents

COLINBRUSCHI
Enthusiast Enthusiast
395 Views
0 Replies
Message 1 of 1

API Refresh vault status for all open documents

COLINBRUSCHI
Enthusiast
Enthusiast

Hi All,

 

After checking a part out & into vault programmatically via an add-in , the vault status in the vault status panel still shows "checked out" for the part as well as open assemblies the part resides in, until the status is refreshed in all these documents. The following code executes a vault refresh command on the active document and then activates all the open documents and should refresh their vault status trees as well, however only the status of the initial active document is refreshed, any thoughts?

 

Dim pDoc As Document
Dim originalDocument As String = g_inventorApplication.ActiveDocument.DisplayName    'remember the document from which the program was run
Dim ctrDef As ControlDefinition = g_inventorApplication.CommandManager.ControlDefinitions.Item("VaultRefresh")
ctrDef.Execute()

For Each pDoc In g_inventorApplication.Documents.VisibleDocuments   'activate each open document

     If Not pDoc.DisplayName.Contains(originalDocument) Then

           pDoc.Activate()
           ctrDef.Execute()

      End If

Next

For Each pDoc In g_inventorApplication.Documents.VisibleDocuments   'activate the original document

     If pDoc.DisplayName = originalDocument Then
          pDoc.Activate()
     End If
Next

The code that does the checking in is below.

 

''''' Check file in if checked out
        Dim oFileIteration As VDF.Vault.Currency.Entities.FileIteration = Await getFileIteration(oDoc.FullFileName, oConnection)

        If oFileIteration IsNot Nothing Then

            If oFileIteration.IsCheckedOut = True Then

                Dim fldrPath As VDF.Currency.FolderPathAbsolute = New VDF.Currency.FolderPathAbsolute(mfilePath)
                Dim filePathAbs As VDF.Currency.FilePathAbsolute = New VDF.Currency.FilePathAbsolute(oDoc.FullFileName)

                statusCaption.Text = "Checking File Back In..."
                Refresh()

                oConnection.FileManager.CheckinFile(oFileIteration, lblComments.Text, False, New ACW.FileAssocParam() {}, Nothing, False, Nothing, ACW.FileClassification.None, False, filePathAbs)

            End If
        End If
0 Likes
396 Views
0 Replies
Replies (0)