Here is the code snippet on how to use DotCMIS & C# for downloading a document from Alfresco Repository.
try
{
Document doc = session.GetObject(objectId) as Document;
ContentStream contentStream = (DotCMIS.Data.Impl.ContentStream)doc.GetContentStream();
using (var fileStream = File.Create(@".\" + contentStream.FileName))
{
contentStream.Stream.CopyTo(fileStream);
}
MessageBox.Show("File " + contentStream.FileName + " downloaded successfully");
}catch(Exception ex)
{
MessageBox.Show("File " + fileName + " download failed." + ex.Message);
}
The entire Source code can be downloaded here. https://github.com/muralidharand/AlfrescoDotCMISExamples
try
{
Document doc = session.GetObject(objectId) as Document;
ContentStream contentStream = (DotCMIS.Data.Impl.ContentStream)doc.GetContentStream();
using (var fileStream = File.Create(@".\" + contentStream.FileName))
{
contentStream.Stream.CopyTo(fileStream);
}
MessageBox.Show("File " + contentStream.FileName + " downloaded successfully");
}catch(Exception ex)
{
MessageBox.Show("File " + fileName + " download failed." + ex.Message);
}
The entire Source code can be downloaded here. https://github.com/muralidharand/AlfrescoDotCMISExamples
No comments:
Post a Comment