To check in and check out Collaboration documents from a remote application, use the IDocumentManager interface in the IDK.
| Check in comment | Required. A string that will be added as the first check in comment for the new document. |
| Input stream | Required. An InputStream from which the contents of the new document can be read. |
| Language | The ISO 639-1 language code for the content in the document (for example, en for english). If null, the language is set to that of the current user. |
| Keep checked out | If set to true, the document will be checked in and automatically checked out again. The default is false. |
Java
...
IRemoteSession remoteSession = portletContext.getRemotePortalSession();
IDocumentManager documentManager = remoteSession.getCollaborationFactory().getDocumentManager();
//get the document
IDocument checkedOutDocument = documentManager.getDocument(documentID);
//Open an inputstream for the document contents - this can be any InputStream
InputStream fileInputStream = new FileInputStream("c:\\myNewDocument.doc");
//Check in the new version
documentManager.checkInDocument(checkedOutDocument, "updated version of the document", fileInputStream, "en", false);
...
.NET (C#)
...
remoteSession = portletContext.GetRemotePortalSession();
documentManager = remoteSession.GetCollaborationFactory().GetDocumentManager();
//get the document
IDocument checkedOutDocument = documentManager.GetDocument(documentID);
//open an inputstream for the document contents - this can be any readable Stream
Stream fileInputStream = File.OpenRead("c:\\MyNewDocument.doc");
//check in the new version
documentManager.CheckInDocument(checkedOutDocument, "updated version of the document", fileInputStream, "en", false);
...
.NET (VB)
...
dim documentManager As IDocumentManager
dim remoteSession As Plumtree.Remote.PRC.IRemoteSession
remoteSession = portletContext.GetRemotePortalSession()
documentManager = remoteSession.GetCollaborationFactory().GetDocumentManager()
'get the document
IDocument checkedOutDocument = documentManager.GetDocument(documentID)
'Open an inputstream for the document contents - this can be any readable Stream
dim fileInputStream As Stream = File.OpenRead("c:\\MyNewDocument.doc")
'Check in the new version
documentManager.CheckInDocument(checkedOutDocument, "updated version of the document", fileInputStream, "en", false)
...