Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Silent Checkout, C# Web App
Choptalk
I would like to be able to do a slient checkout of a file from a web application. I currently have the following code in place which of course does not work so that's why I'm asking. When the Update() runs it returns a status code of 1 so it never even gets to the Execution phase. Any ideas? Please be gentle, I'm new to this.
public int CheckoutFile(string database, string server, string username, string password, int docnum, int docver)
{
IMANEXTLib.CheckoutCmd myCmd = new IMANEXTLib.CheckoutCmd();
IManage.NRTDocument myDoc;
IMANEXTLib.ContextItems pContextItems = new IMANEXTLib.ContextItems();
ManDMS oDMS = new ManDMS();
IManSession oSession = oDMS.Sessions.Add(server);
oSession.Login(username, password);
IManDatabase odb = oSession.Databases.ItemByName(database);
myDoc = (IManage.NRTDocument)odb.GetDocument(docnum, docver);
int pWin = 0;
pContextItems.Add("ParentWindow",pWin);
pContextItems.Add("SelectedNRTDocuments",myDoc);
pContextItems.Add ("IManExt.CheckoutCmd.NoVersionPrompts", true);
pContextItems.Add ("IManExt.CheckoutCmd.NoCmdUI", true);
pContextItems.Add("IManExt.CheckoutCmd.NoCheckingBeforeCheckout", true);
myCmd.Initialize(pContextItems);
myCmd.Update();
if ((CommandStatus)myCmd.Status == CommandStatus.nrActiveCommand)
{
myCmd.Execute();
}
return myDoc.Number;
}
Find more posts tagged with
Comments
Choptalk
I got it working...
Here is my code in case anyone else comes looking for it.
IMANEXTLib.CheckoutCmd myCmd = new IMANEXTLib.CheckoutCmd();
IManage.NRTDocument [] myDoc;
myDoc = new IManage.NRTDocument[1];
IMANEXTLib.ContextItems pContextItems = new IMANEXTLib.ContextItems();
ManDMS oDMS = new ManDMS();
IManSession oSession = oDMS.Sessions.Add(server);
oSession.Login(username, password);
IManDatabase odb = oSession.Databases.ItemByName(database);
myDoc[0] = (IManage.NRTDocument)odb.GetDocument(docnum, docver).LatestVersion;
long pWin = 0;
pContextItems.Add("ParentWindow",pWin);
pContextItems.Add("SelectedNRTDocuments",myDoc);
pContextItems.Add ("IManExt.CheckoutCmd.NoVersionPrompts", true);
pContextItems.Add ("IManExt.CheckoutCmd.NoCmdUI", true);
pContextItems.Add("IManExt.CheckoutCmd.NoCheckingBeforeCheckout", true);
myCmd.Initialize(pContextItems);
myCmd.Update();
if ((CommandStatus)myCmd.Status == CommandStatus.nrActiveCommand)
{
myCmd.Execute();
}