0

我尝试使用 DotCMIS 从 Alfresco 下载文件到本地文件夹,但文件始终保存为空白,我的代码:

  ISession session = startSession();
  IObjectId id = session.CreateObjectId(fileId);

  Dictionary<String, Object> properties = new Dictionary<String, Object>();

  properties.Add(PropertyIds.Name, file);
  properties.Add(PropertyIds.ObjectId, fileId);
  properties.Add(PropertyIds.ObjectTypeId, "cmis:document,P:cm:titled");


  IDocument docx = session.GetObject(fileId) as IDocument;
  IContentStream content = docx.GetContentStream();
  Stream stream = content.Stream;
  string path = @"C:\Windows\Temp\" + docx.Name;

  using (stream = File.Create(path)) {}

谢谢大家

4

1 回答 1

0

那样工作:

        BufferedStream document = (BufferedStream)content.Stream;

        string path = @"C:\Windows\Temp\" + docx.Name;

        using (FileStream stream = File.Create(path))
        {
            document.CopyTo(stream);
        }

谢谢大家

于 2015-04-13T19:40:56.407 回答