【问题标题】:Is it possible to export attachments from Microsoft Dynamics CRM 4.0 to a local file system and record relevant metadata?是否可以将附件从 Microsoft Dynamics CRM 4.0 导出到本地文件系统并记录相关元数据?
【发布时间】:2014-09-26 07:22:49
【问题描述】:
  • 有可能吗?
  • MS Dynamics 4.0 是否有公开的 Web 服务 API,可以 可能会做被要求做的事情?
  • db scheman 是否足够简单,可以识别 包含用于导出文档的数据的表和行 相关元数据?
  • 附件是否准确 存储在 CRM 的“注释”实体中?

【问题讨论】:

    标签: web-services api export crm dynamics-crm-4


    【解决方案1】:
    • 是的,有可能。
    • 是的,CRM 4.0 具有访问数据的 API。
    • 是的,架构很简单,可在 MSDN 上找到。
    • 是的,附件存储在Annotation 实体documentbody 字段中,数据编码为Base64 字符串。

    【讨论】:

      【解决方案2】:

      这是一个 2011 版本,应该在很大程度上向后兼容并且涵盖了要点。

      http://woodsworkblog.wordpress.com/2012/07/28/exporting-annotation-note-attachment/

      public void ExportDocuments(IOrganizationService service, String filePath)
      {
           String fetch = @"<fetch mapping='logical' count='100' version='1.0'>
                <entity name='annotation'>
                     <attribute name='filename' />
                     <attribute name='documentbody' />
                     <attribute name='mimetype' />
                </entity>
           </fetch>";
      
           foreach (Entity e in service.RetrieveMultiple(new FetchExpression(fetch)))
           {
                if (!String.IsNullOrWhiteSpace(e.Attributes["documentbody"].ToString()))
                {
                     byte[] data = Convert.FromBase64String(e.Attributes["documentbody"].ToString());
      
                     File.WriteAllBytes(filePath + e.Attributes["filename"].ToString(), data);
                }
           }
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多