locked
Get BLOB data via BCS RRS feed

  • Question

  • Hi! I'm stuck and would like to have som help ;)

    I have a SQL Database where we store some PDF:s as BLOB data (Database field type: VARBINARY (MAX)) but I have huge problems getting that PDF in SharePoint. Getting all other values are no problem but I want to be able to download the PDF.

    The database name is: tdsqldb, the tables name is dbo.Arenden and the blobfields name is: PDFRapport

    I have created one Method for reading all items, and one Method for a single Item and both are working as they should. After that I have tried to creade a StreamAccessor method that takes one param in and that is the "Id" kolumn (PK, int, not null) and it should return the PDFRapport param that is the binary stream.

    The only error message I get is: Could not get data from the external system: The given dot notation 'PDFRapport' refers to a node in Type Descriptor that does not exist

    Here is the Method:

    <Method IsStatic="false" Name="Get PDFRapport">
     <Properties>
      <Property Name="BackEndObject" Type="System.String">Arenden</Property>
            <Property Name="BackEndObjectType" Type="System.String">SqlServerTable</Property>
            <Property Name="RdbCommandText" Type="System.String">SELECT [PDFRapport] FROM [dbo].[Arenden] WHERE [Id] =  @Id</Property>
            <Property Name="RdbCommandType" Type="System.Data.CommandType, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">Text</Property>
            <Property Name="Schema" Type="System.String">dbo</Property>
     </Properties>
     
     <Parameters>
      <Parameter Direction="In" Name="@Id">
       <TypeDescriptor TypeName="System.Int32" IdentifierName="Id" Name="Id" />
      </Parameter>
      
      <Parameter Direction="Return" Name="PDFReadStream">
       <TypeDescriptor TypeName="System.Data.IDataReader, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" Name="PDFReadStream">
        <TypeDescriptors>
         <TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="PDFReadStreamElement">
          <TypeDescriptors>
           <TypeDescriptor TypeName="System.Byte[]"  Name="PDFRapport" />
          </TypeDescriptors>
         </TypeDescriptor>
        </TypeDescriptors>
       </TypeDescriptor>
      </Parameter>
     </Parameters>
     
     <MethodInstances>
      <MethodInstance Type="StreamAccessor" ReturnParameterName="PDFReadStream" ReturnTypeDescriptorPath="PDFReadStream[0].PDFRapport" Name="PDFReadStream" Default="true" DefaultDisplayName="PDFRapport">
       <Properties>
        <Property Name="FileNameField" Type="System.String">PDFRapport.pdf</Property>
       </Properties>
       <AccessControlList>
        <AccessControlEntry Principal="contoso\administrator">
         <Right BdcRight="Edit" />
         <Right BdcRight="Execute" />
         <Right BdcRight="SetPermissions" />
         <Right BdcRight="SelectableInClients" />
        </AccessControlEntry>
       </AccessControlList>
      </MethodInstance>
     </MethodInstances>
    </Method>
       

    Wednesday, October 14, 2015 7:08 PM

Answers

  • Hi,

    As I understand, you encountered the error when get BLOB data by streamAccessor method in SharePoint 2013.

    You could check if the input parameter configuration is correct in external content type.

    You also could check if the StreamAccessor method is correct according to the articles below.

    The article below is about accessing BLOB Data from External Systems Using Business Connectivity Services in SharePoint Server 2010. It also can work in SharePoint 2013.

    https://msdn.microsoft.com/en-us/library/office/ff634782(v=office.14).aspx

    The article below is about using BCS to Read BLOB Data. It also can work in SharePoint 2013.

    http://sharepointpromag.com/sharepoint/using-bcs-read-blob-datav

    Best regards,

    Sara Fan


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    • Proposed as answer by Victoria Xia Wednesday, October 21, 2015 8:39 AM
    • Marked as answer by Victoria Xia Thursday, October 29, 2015 9:13 AM
    Friday, October 16, 2015 6:58 AM