在 OData 中使用 BLOB/StreamAccessor 的 SharePoint BDC

问题描述

BDC 支持抓取外部内容类型的 BLOB。有 how to do that with a SQL-Database and a StreamAccessor method in the BDC model 的样本。我终于让它起作用了,包括全文搜索

BDC 也支持 OData,但是它是否支持爬取 OData 中的 BLOB?我在 BDC 模型中测试了许多选项,但没有人使用 BLOB。

当 OData 实体返回 byte[](如在 sql-Sample 中)时,BDC 显示 InvalidOperationException: The MethodInstance with Name 'DataAccessor' of Type 'StreamAccessor' returned 'null' or did not return an AdapterObject that is streamable. Are you using a shim that supports streaming?

我还测试了 OData media link entry (HasStream),但它因 http 415(请求不支持媒体类型)而失败,因为对 /Document(1)/$value 的请求是使用 application/atom+xml 标头发出的。

我尝试了 Implementing a StreamAccessor,但到目前为止还没有让它起作用。

需要什么才能让 BDC 与 OData 和 BLOB 爬行一起工作?

这是我的 BDC 文件中的方法示例:

<Method Name="GetData">
  <Properties>
    <Property Name="ODataEntityUrl" Type="System.String">/Documents(@Id)</Property>
  </Properties>
  <Parameters>
    <Parameter Name="@Id" Direction="In">
      <TypeDescriptor Name="Id" DefaultdisplayName="Id" TypeName="system.int32" IdentifierName="Id" />
    </Parameter>
    <Parameter Name="@Document" Direction="Return">
      <TypeDescriptor Name="Document" DefaultdisplayName="Document" TypeName="Microsoft.BusinessData.Runtime.DynamicType">
        <TypeDescriptors>
          <TypeDescriptor Name="Data" DefaultdisplayName="Data" TypeName="System.Byte[]" />
        </TypeDescriptors>
      </TypeDescriptor>
    </Parameter>
  </Parameters>
  <MethodInstances>
    <MethodInstance Name="DataAccessor" Type="StreamAccessor" Default="true" ReturnParameterName="@Document" ReturnTypeDescriptorPath="Document.Data" DefaultdisplayName="Document">
      <Properties>
        <Property Name="FileNameField" Type="System.String">displayName</Property>
      </Properties>
    </MethodInstance>
  </MethodInstances>
</Method>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)