Vault Customization

Reply
Valued Contributor kbo
Valued Contributor
kbo
Posts: 84
Registered: ‎08-18-2010
Message 1 of 3 (170 Views)

API Error when checking out library files from vault.

170 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
wayne.brill
Posts: 198
Registered: ‎08-25-2004
Message 2 of 3 (129 Views)

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
kbo
Posts: 84
Registered: ‎08-18-2010
Message 3 of 3 (111 Views)

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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community