Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
NRTiDs Revisited....
System
For links to WorkSite documents on our Intranet, we are using a link to viewdoc.asp, and specifying the document and version number "document,version" - is there a parameter I can pass in the URL or in the NRTID to tell WorkSite to open the *latest version* without having to know what it is?
D
Find more posts tagged with
Comments
jny
What you could do is before passing in the current NRTID (which is actually the document object moniker) get the handle to the document object itself, by either of these methods below, to get to the latest version.
[C#]
//-- METHOD1: Get doc by moniker
// Assuming dms is a valid handle to a connected IManDMS object.
IManDocument doc = dms.GetObjectBySID(NRTID);
IManDocument latestdoc = doc.LatestVersion;
//-- METHOD2: Get doc by number/version
// Assuming db is a valid handle to a IManDatabase object.
IManDocument doc = db.GetDocument(num, ver);
Note: you may parse the current NRTID for the database name, and doc/ver numbers.
Once you have obtained the handle to the latest version, you may then use its moniker instead to build the url to VIewDoc.asp.
dabird
Unfortunately ViewDoc does not have that capability. There are two alternative solutions.
The first suggestion is to send your users to GetDoc.aspx with your current nrtid. That has logic built in to prompt the user to use the latest version. If the user chooses to use the latest version, then the original nrtid you supplied is replaced with the nrtid for the latest version before being redirected to ViewDoc. The downside to this is that it requires more interaction from your end-user. A sample URL is
http://myWorkSite/GetDoc.aspx?nrtid=<yourNrtid>
The second solution requires a bit more work on your end. You could create some custom code that gets an IManDocument object based on the current nrtid you have. Off of the document object, you can get another IManDocument object from the LatestVersion property. Once you get that object, simply pass its ObjectID to ViewDoc. While this will be less burdensome on your end user, it requires, however, that your code logs in the current user.
Here's a C# sample of the 2nd explanation:
string nrtid = <this is the string that you currently have>;
//need to login to WorkSite
IManDocument doc = <use iManage.dll to get the doc corresponding to your nrtid>;
//this will return the latest version to which the user has access; it may not be THE latest version based on security settings
IManDocument latest = doc.LatestVersion;
//redirect to viewDoc with the nrtid from the LatestVersion object
"<URL to ViewDoc>?nrtid=" + latest.ObjectID;
Lastly, you could also submit an enhancement request for this feature.
jny
Once you have the latest version document object handle, you may also get the latest version number to use in your viewdoc.asp instead of the NRTID. The idea is the get to the latest version number off of the IManDocument/NRTDocument.LatestVersion Property.