Monday, February 1, 2016

Alfresco DotCMIS : File upload using dotCMIS and C#

Here is the code snippet on how to use DotCMIS & C# for uploading a document to Alfresco Repository.

IDictionary DocumentProperties = new Dictionary();
DocumentProperties[PropertyIds.Name] = FileName;
DocumentProperties[PropertyIds.ObjectTypeId] = "cmis:document";
Stream temp = new MemoryStream(content);
ContentStream contentStream = new ContentStream();
contentStream.FileName = FileName;
contentStream.MimeType = "image/jpeg";
contentStream.Length = content.Length;
contentStream.Stream = new MemoryStream(content);
IDocument doc = documentTypeFolderRef.CreateDocument(DocumentProperties, contentStream, DotCMIS.Enums.VersioningState.Major);

The entire Source code can be downloaded here.

No comments:

Post a Comment