【问题标题】:Download from the Alfresco to a local folder从 Alfresco 下载到本地文件夹
【发布时间】:2015-04-14 03:40:56
【问题描述】:

我尝试使用 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)) {}

谢谢大家

【问题讨论】:

  • 将内容流写入文件的代码在哪里?

标签: c# alfresco dotcmis


【解决方案1】:

这样工作:

        BufferedStream document = (BufferedStream)content.Stream;

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

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

谢谢大家

【讨论】:

    猜你喜欢
    • 2019-02-16
    • 2019-02-20
    • 1970-01-01
    • 2013-06-26
    • 2011-01-03
    • 1970-01-01
    • 1970-01-01
    • 2020-10-10
    • 1970-01-01
    相关资源
    最近更新 更多