2

How can i checkout a document from Alfresco using dotCMIS?

Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
user673453
  • 167
  • 1
  • 4
  • 16

1 Answers1

4

It's in the IDocument interface:

IObjectId id = session.CreateObjectId("12345678");
IDocument doc = session.GetObject(id) as IDocument;
IDocument checkedOutDoc = doc.CheckOut() as IDocument;
skuro
  • 13,414
  • 1
  • 48
  • 67
  • i get the following error :DotCMIS.Exceptions.CmisInvalidArgumentException: Bad Request – user673453 Apr 24 '12 at 08:37
  • are you sure you're using an id to a document (`cm:content` in Alfresco) when calling `CreateObjectId`? – skuro Apr 24 '12 at 09:28
  • how can i get the id of a document? I am new to alfresco and cmis – user673453 Apr 24 '12 at 09:49
  • from Alfresco Share, when you look at the details page of a document you can take the value of the `nodeRef` parameter in the URL (e.g. `http://alfresco.host:8080/share/page/document-details?nodeRef=workspace://SpacesStore/38dee96f-e028-4bed-821f-0ed25cc2ba07`). From the Alfresco Explorer, the document details page has an "Alfresco Node Reference" link. – skuro Apr 24 '12 at 10:04
  • got that. But how can i open the file in my client application? – user673453 Apr 24 '12 at 11:07
  • you need to get the content stream: `IContentStream contentStream = doc.GetContentStream();`. I strongly suggest you to read more on [CMIS](http://www.optaros.com/blogs/new-tutorial-getting-started-with-cmis) before continuing your development. – skuro Apr 24 '12 at 11:47
  • @user673453: You should accept this answer if it is a solution to the question you asked originally. – Nicolas Raoul Nov 20 '12 at 05:32