Hello,
The new Thin Client 2014 (with subscription advantage pack) has a new kind of URL to access file (regarding the fileID).
http://servername/AutodeskTC/servername/vaultname#/Entity/Details?id=mRklMRTpMQVRFU1Q6MTMxOTQxNA&itemtype=File
How can we create this URL from a file in Vault (my goal is to create the URL from a Vault-Addin in order to place this URL in a ERP system).
I try with persistantID but I don't get the same ID. And if I try to resolve the ID (mRklMRTpMQVRFU1Q6MTMxOTQxNA) in Vault API, I don't get anything...
Is there a way to create this URL?
Thanks in advance for you help and have a nice day.
Solved! Go to Solution.
Solved by Daniel.Du. Go to Solution.
Hi,
GetPersistentIds and ResolvePersistentIds in the KnowledgeVaultService are the functions to use for converting between file IDs and the persistent IDs. Keep in mind that there are two types of persistent IDs for files. If EntPersistOpt is History, the Persistent ID is for a specific file version. If EntPersistOpt is Latest, the Persistent ID is for the latest version of the file. The caller has to know which type to use. There is no way to tell the type by looking at the Persistent ID itself.
Following code works fine for me :
void ThinClientUrlCmd_Execute(object sender, CommandItemEventArgs e)
{
WebServiceManager webMgr = e.Context.Application.Connection.WebServiceManager;
ISelection selectedItem = e.Context.CurrentSelectionSet.FirstOrDefault<ISelection>();
if (selectedItem != null)
{
if (selectedItem.TypeId == SelectionTypeId.File || selectedItem.TypeId == SelectionTypeId.FileVersion)
{
File file = webMgr.DocumentService.GetLatestFileByMasterId(selectedItem.Id);
string[] ids = webMgr.KnowledgeVaultService.GetPersistentIds("FILE",
new long[]{file.Id},
Autodesk.Connectivity.WebServices.EntPersistOpt.Latest);
string id = ids[0];
id = id.TrimEnd('=');
string result = string.Format("{0}://{1}/AutodeskTC/{1}/{2}#/Entity/Details?id=m{3}=&itemtype=File",
"Http", "localhost", e.Context.Application.Connection.Vault, id);
System.Windows.Forms.MessageBox.Show(result);
}
}
}
Can't find what you're looking for? Ask the community or share your knowledge.