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: 

DownloadFile.

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
411 Views, 4 Replies

DownloadFile.

I made a program for Vault 2013. Unfortunately it don’t work for Vault 2014. I’ve tried to figure out how to rewrite it to 2014, but I struggle. The problem is DownloadFile that has been removed from WebServices. I had the lines below in my code. It should get a file from Vault by Id and save the file in the folder “c:\Vault export\” outside our local Vault area. Any tip on how I should rewrite it would be appreciated.

 

docSrv.DownloadFile(oFileAssoc.ParFile.Id, True, oBytes)

System.IO.File.WriteAllBytes("C:\\" + "Vault export\" & oFileAssoc.ParFile.Name, oBytes.Bytes)

4 REPLIES 4
Message 2 of 5
Redmond.D
in reply to: Anonymous

Message 3 of 5
Anonymous
in reply to: Redmond.D

Thanks.

But if I got a fileid for instance 2591234 how do I convert it to an ICollection so that I can use the sub

 

Public Sub DownlodFiles(fileIters As ICollection(Of VDF.Vault.Currency.Entities.FileIteration))

Message 4 of 5
Anonymous
in reply to: Anonymous

I found a method.

 

Imports Framework = Autodesk.DataManagement.Client.Framework

 

 

        Dim lFileIds(0 To 0) As Long

        lFileIds(0) = lIndex

 

        Dim oFiles As Autodesk.Connectivity.WebServices.File()

        oFiles = m_conn.WebServiceManager.DocumentService.GetFilesByIds(lFileIds)

 

        Dim FileList As List(Of Autodesk.Connectivity.WebServices.File)

        FileList = New List(Of Autodesk.Connectivity.WebServices.File)()

 

        If (Not lFileIds Is Nothing) Then

            FileList.AddRange(oFiles)

        End If

 

        Dim oFileIteration As Framework.Vault.Currency.Entities.FileIteration

        oFileIteration = New Framework.Vault.Currency.Entities.FileIteration(m_conn, FileList(0))

Message 5 of 5
Redmond.D
in reply to: Anonymous

That code works, but there is an easier way.  You can call m_conn.FileManager.GetFilesByIterationIds(...)



Doug Redmond
Software Engineer
Autodesk, Inc.

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

Post to forums  

Autodesk Design & Make Report