Ok,
So I've been doing my homework and this is what I have so far:
Step 1: Learn How to Login / Authenticate to the Vault:
Via GUI : https://www.youtube.com/watch?v=2ytpvxlED7s
For my purpose I am just hard coding it for now:
using VDF = Autodesk.DataManagement.Client.Framework;
.....
VDF.Vault.Results.LogInResult results = VDF.Vault.Library.ConnectionManager.LogIn( "serverName", "VaultName", "userName", "Password", VDF.Vault.Currency.Connections.AuthenticationFlags.Standard, null );
//close if failure
if (!results.Success) return;
VDF.Vault.Currency.Connections.Connection conn = results.Connection;
Step2: Learn how to get a file (given a known path)
string path = "$/Test vault/test inventor projects/LIBRARY2/C2v171-XX3.idw";
//Need array for findLatestDocuments
string[] paths = new string[1];
//Assign array 0 as your path
paths[0] = path;
//get file and load into files array
Autodesk.Connectivity.WebServices.File[] files = conn.WebServiceManager.DocumentService.FindLatestFilesByPaths(paths);
//dump name to textbox to test
textBox1.Text = files[0].Name.ToString();
Step 3: Get a list of available File properties
////Get list of properties
PropDefInfo[] propDefs = conn.WebServiceManager.PropertyService.GetPropertyDefinitionInfosByEntityClassId("FILE",null);
////dump to listbox to test
foreach (PropDefInfo propDef in propDefs)
{
this.listBox1.Items.Add(propDef.PropDef.SysName.ToString() );
}
Step 4: View current file property values / learn to access a specific properties (by sysName?)
Struggling with this one a little. Mosty just trying to figure out the correct syntax. I am looking at the PropertyService.GetProperties() function but I am a little confused. It is expecting as arguments a string representing the classID, which I assume is "FILE", but the other two arguments are long[] entityIds and long[] propertyDefIds. I'm not sure how to pass those values. I was originally thinking it would be something like file[0].Entity or file[0].PropertyName.Entity etc... but I am way off base.
Step 5: Learn how to update the file properties.
Still a WIP. I saw this example (link) and am trying to modify that. According to this source I need to use IExplorerUtil.UpdateFileProperties if I want to update the properties in the Vault and in the file itself. As I understand it, IExplorerUtil.UpdateFileProperties requires a reference to Autodesk.Connectivity.Explorer.ExtensibilityTools.dll which I don't seem to have. I did some more searching and found this source where Doug Redmond mentions I need the vault client, so I am trying to get the installation media to get that installed on my machine. Once done I am hoping the dll will be installed and the code will be something to the tune of:
Dictionary<Autodesk.Connectivity.WebServices.PropDef,String> dict = new Dictionary<Autodesk.Connectivity.WebServices.PropDef,String>();
dict.Add(propDefs[5].PropDef, "New Description Value"); //etc
IExplorerUtil.UpdateFileProperties(files[0], dict);
Summary / Questions
As you can see I'm making progress but still have issues. If anyone has any input or advise on steps 4/5 I would greatly appreciate it. Specifically I am trying to work out the entityIds for the GetProperties() function, and how to properly use the IExplorerUtil.UpdateFileProperties() function. With these steps figured out I can pull in my SQL data and loop through the files that need to be updated.
My apologies if this is rudamentary to any of you guys. My background is in databases, not programming.