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?
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.
Thanks,
Wayne
hi,
Yes, I can create a new folder in Vault, using the method AddFolder.