My first Autodesk Vault customization Program

Source: Internet
Author: User
Tags microsoft website

Our Vault development expert Barbara left and I had to start learning about the Vault API. If you are just learning about Vault, this article may help you. The Vault client primarily uses Web Services to communicate with the Vault server. The Vault also provides a wide range of APIS, including various WebServices. Vault provides. net APIs, which can be customized using C # Or VB.net. The development tool is Visual Studio. In the beginning of Vault 2013, Vault API supports. net framework 4.0. Here we use VS2010. to do the simplest WinForm program, enumerate all files on the Vault server.

 

The Vault SDK is installed with the Vault Server or Vault Client. You can find the Vault SDK installation file under the Vault installation directory \ SDK directory. After the installation is complete, you can obtain the following directories:

 

First, create a WinForm application. Note that for Vault 2013, you need to use. net Framework 4.0. Add a listbox and a button on it, and then add references. As an independent application, you only need to reference Autodesk. Connectivity. WebServices. dll, and then write the code as follows:

 

Using System;
Using System. Collections. Generic;
Using System. ComponentModel;
Using System. Data;
Using System. Drawing;
Using System. Linq;
Using System. Text;
Using System. Windows. Forms;
Using Autodesk. Connectivity. WebServicesTools;
Using Autodesk. Connectivity. WebServices;


Namespace HelloVault
{
Public partial class Form1: Form
{
Public Form1 ()
{
InitializeComponent ();
}

Private void button#click (object sender, EventArgs e)
{
// Use the specified user name and password to connect to the vault of the specified server
UserPasswordCredentials cred = new UserPasswordCredentials
("Bei9m4jxix", "Vault", "Administrator ","");

// Obtain WebService Manager
Using (WebServiceManager mgr = new WebServiceManager (cred ))
{
// WebServiceManager can be used to obtain the document service and other services
// Obtain the Vault root directory
Folder root = mgr. DocumentService. GetFolderRoot ();
// Recursively print directories and files on the Vault server
PrintFolder (root, mgr );
}
}

Public void PrintFolder (Folder folder, WebServiceManager mgr)
{
File [] files = mgr. DocumentService
. GetLatestFilesByFolderId (folder. Id, true );
If (files! = Null)
{
Foreach (var file in files)
{
// Change the file name in batches
File. Name + = "_ modi ";
ListBox1.Items. Add (folder. FullName + "\" + file. Name );
}
}
Folder [] subFolders = mgr. DocumentService
. GetFoldersByParentId (folder. Id, false );
If (subFolders! = Null)
{
Foreach (var subFolder in subFolders)
{
PrintFolder (subFolder, mgr );
}
}

}
}
}

 

 

The code is not complex. during compilation, the 'Microsoft. Web. Services3.WebServicesClientProtocol assembly cannot be found,

Error 1 The type 'Microsoft. web. services3.WebServicesClientProtocol 'is defined in an assembly that is not referenced. you must add a reference to assembly 'Microsoft. web. services3, Version = 3.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 '.

Follow the prompts to add a reference to 'Microsoft. Web. services3. If you have installed the Vault Client, the dll is in the C: \ Program Files (x86) \ Microsoft WSE \ v3.0 directory. If you have not installed the Vault client, you need to download WSE3 (Web Service Extension) from the Microsoft website)

 

In addition, there is an error message:

Error 1 The type 'System. web. services. protocols. soapHttpClientProtocol 'is defined in an assembly that is not referenced. you must add a reference to assembly 'System. web. services, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a '.

Need to addSystem. Web. Services.

Then compile and run the program. The result is as follows:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.