Vault Customization

Vault Customization

Reply
Valued Contributor kbo
Valued Contributor
99 Posts
5 Kudos
Registered: ‎08-18-2010
Post 1 of 3

API Error when checking out library files from vault.

183 Views, 2 Replies
06-25-2013 06:06 AM

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

ADN Support Specialist
256 Posts
32 Kudos
Registered: ‎08-25-2004
Post 2 of 3

Re: API Error when checking out library files from vault.

07-02-2013 01:27 PM 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

Valued Contributor kbo
Valued Contributor
99 Posts
5 Kudos
Registered: ‎08-18-2010
Post 3 of 3

Re: API Error when checking out library files from vault.

07-15-2013 06:30 AM 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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!