public void CancelCheckout(string docId) { this.session = this.GetSession(); IObjectId obj = new ObjectId(docId); IDocument pwc = (IDocument)this.session.GetObject(obj); pwc.CancelCheckOut(); }
public void CheckoutTest( string canonical_name, string localPath, string remoteFolderPath, string url, string user, string password, string repositoryId, string binding) { string subFolderName = "subFolder"; string fileName = "testFile.bin"; string subFolderPath = remoteFolderPath.TrimEnd('/') + "/" + subFolderName; string filePath = subFolderPath + "/" + fileName; ISession session = DotCMISSessionTests.CreateSession(user, password, url, repositoryId, binding); if (!session.ArePrivateWorkingCopySupported()) { Assert.Ignore("PWCs are not supported"); } try { IFolder dir = session.GetObjectByPath(remoteFolderPath.TrimEnd('/') + "/" + subFolderName) as IFolder; if (dir != null) { dir.DeleteTree(true, null, true); } } catch (CmisObjectNotFoundException) { } IFolder folder = (IFolder)session.GetObjectByPath(remoteFolderPath); IFolder subFolder = folder.CreateFolder(subFolderName); IDocument doc = subFolder.CreateDocument(fileName, "testContent", checkedOut: true); IObjectId checkoutId = doc.CheckOut(); IDocument docCheckout = (IDocument)session.GetObject(checkoutId); Assert.AreEqual(doc.ContentStreamLength, docCheckout.ContentStreamLength); doc.Refresh(); Assert.IsTrue(doc.IsVersionSeriesCheckedOut.GetValueOrDefault()); Assert.AreEqual(checkoutId.Id, doc.VersionSeriesCheckedOutId); docCheckout.CancelCheckOut(); doc.Refresh(); Assert.IsFalse(doc.IsVersionSeriesCheckedOut.GetValueOrDefault()); Assert.IsNull(doc.VersionSeriesCheckedOutId); }