Hi,
By any chance, can somebody share C# code samples for creating folders and deleting files using CWS?
Thanks,
Alex
//Creating Folder by passing ParentID and Folder Name private int AddFolder(int ParentId, string FolderName, string FolderComment = "Enter the Description here" ) { DocumentManagementClient docMan = new DocumentManagementClient();
OTAuthentication OtAuth = new OTAuthentication();
OtAuth.AuthenticationToken = General.AuthToken;
Node FolderNode = null; int FodlerObjectID ;
//metadata - Enter null to inherit parent's metadata otherwise enter Metadata for this object FolderNode = docMan.CreateFolder(OtAuth, ParentId, FolderName, FolderComment, null);
FodlerObjectID = FolderNode.ID; Console.WriteLine("Created Folder Object ID: " + FodlerObjectID); return FodlerObjectID;
}
//Deleting file by passing File Obejct ID private void DeleteFile(int FileObjectID) { DocumentManagementClient docMan = new DocumentManagementClient();
OtAuth.AuthenticationToken = General.AuthToken; docMan.DeleteNode(OtAuth, FileObjectID);
Hope this helps.
Cheers,
Kingsley
Got it, thanks a lot!
Hi Kingsley,
I went through all OT code samples, there is always sending username and password for getting authentication token. Is there any way to use credentials of current system user already authenticated in domain?
Thank you,
If you dont put parameter to the new OTAuthentication(); function, it will use the windows token
Hi Guy,
Thanks for reply. Did you mean excluding OtAuth.AuthenticationToken = authToken line like here:
//OtAuth.AuthenticationToken = authToken;
I just commented this line and immediatly got System.ServiceModel.FaultException with empty exception message.
Should this parameter be set in some special way for using domain credentials?
Hi Alex,
You can also refer following post where Appu explains in detail:https://knowledge.opentext.com/knowledge/cs.dll/open/55438782
Regards,Kingsley
Thank you for the link, I'll try it.