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: 

Vault Powershell commandlet: Upload file to Vault.

2 REPLIES 2
Reply
Message 1 of 3
kolesaa
1053 Views, 2 Replies

Vault Powershell commandlet: Upload file to Vault.

Hello

 

Trying to make the first script on PowerShall to Vault. I want to download the file from the local drive in the Vault:

 

...load all *.dll

 

function Add-VaultFile

{

$folder = New-Object Autodesk.DataManagement.Client.Framework.Vault.Currency.Entities.Folder ("$/123")

$g_login.FileManager.AddFile(
$folder,
$null,
$null,
$null,
$null,
$false,
"C:\TEMP\1.txt")
}

$global:g_login=[Autodesk.DataManagement.Client.Framework.Vault.Forms.Library]::Login($null)

Add-VaultFile 

 

Errors appear

New-Object: Can not find an overload for "Folder" and the number of arguments: "1."

Can not find an overload for "AddFile" and the number of arguments: "7."

 

Please help, what's wrong?

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

Hi,

 

I am not an expert with PowerShell. Are you trying to create a new folder in Vault? If so the DocumentService has an AddFolder method. If you are trying to get an existing folder then you could use  the RootFolder property of the FolderManager and then one of it's methods such as GetChildFolders. I believe the error is occuring because the constructor for a folder takes the connection and a webServiceFolder.

 

In my tests I am not finding an AddFile() method that takes 7 arguments. (It looks like this is a problem with the Vault SDK help). You can see an example of AddFile() in this SDK sample:

C:\Program Files (x86)\Autodesk\Autodesk Vault 2014 SDK\VS10\CSharp\VaultBrowserSample

 

This blog post has a VB.NET example that uses AddFile() and it also gets a folder.

http://adndevblog.typepad.com/manufacturing/2013/09/vault-2014-api-example-that-adds-a-file-and-asso...

 

 

Thanks,

Wayne

 

 

 



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Message 3 of 3
kolesaa
in reply to: wayne.brill

hi,

 

Yes, I can create a new folder in Vault, using the method AddFolder.

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

Post to forums  

Autodesk Design & Make Report