Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

API Error when checking out library files from vault.

2 REPLIES 2
Reply
Message 1 of 3
kbo
Advocate
381 Views, 2 Replies

API Error when checking out library files from vault.

I createt a program that checks out files from the vault, to synchronize some properties in the inventor files. But when a part inserted from a library I get an error (E_NOINTERFACE) what can be wrong. All other parts and assemblies are checked out fine. See pictures.

When I right click the part in the browser and select checkout the part from the library is checked out fine.

Any suggestions on how to solve this? Please help. see attachment

private sub DoSomeThing()

bla.
bla.
bla.

 Dim fileData As Byte() = Nothing

                    oVaultFile = DocSrv.CheckoutFile(ThisFileFolderID, ThisFileID, CheckoutFileOptions.Master, strHostName, strLocalFilePathWithFileName, "Ax2009 Properties sync.", False, False, fileData)

                    Dim mfilepath As String = (strLocalFilePathWithoutFileName & oVaultFileName)

                    SetFileReadAccess(oVaultFile, mfilepath)

end sub

 ' Sets the read-only value of a file. 
    Sub SetFileReadAccess(ByVal LocalVaultfile As Autodesk.Connectivity.WebServices.File, ByVal LocalVaultFilePath As String) ', ByVal SetReadOnly As Boolean'ByVal LocalPath As String,

        Try

            Dim info As System.IO.FileInfo = New FileInfo(LocalVaultFilePath)
            info.IsReadOnly = False
            info.CreationTime = LocalVaultfile.CreateDate
            'info.Attributes = info.Attributes Or FileAttributes.[ReadOnly]


        Catch ex As Exception

            MsgBox(ex.Message)

        End Try

 

ment

2 REPLIES 2
Message 2 of 3
wayne.brill
in reply to: kbo

Hi Kbo,

I am not sure what the problem is. What is the file that is downloaded? The error indicates that there is a problem casting the object to an AssemblyDocument. This would make sense if the com object was an .ipt file. Is this error occurring on a line in the code that is the post? The error seems like it would occurring when using the Inventor API.

 

Also I searched and found this post. (not sure if it applies to this issue)

http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/How-to-add-part-Assembly-from-Vault-Li...

>> >>

Developer needs to use both Inventor and Vault API:

- use Vault API (either DocumentService.DownloadFile or IExplorerUtil.DownloadFile) to download file from Vault to local workspace. IExplorerUtil is preferred way because it handles couple of things for developer (i.e. finding our correct file location, resolving file references, setting attributes for local file). - use Inventor API to place library part into assembly (various ComponentOccurrence.Add.. methods).

 

When new assembly is added to Vault later then the library part will be automatically recognized by Vault and used for references.

 << <<



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Message 3 of 3
kbo
Advocate
in reply to: wayne.brill

Thanks for your reply Wayne

This was actually a "Error 40”. 40 cm. from the keyboard :-(, my own fault I did not think about that the library files comes from a different share than the default workspace. It works now

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report