Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Can SharePoint 2010 BCS return multiple attachments? I have a database which stores multiple attachments per entity. Would like to have all of them accessible, but I've insufficient experience with BCS/BDC to say whether or not this is possible.

share|improve this question
Did you ever got this figured out? I have the exact same issue and trying to gather ideas on how to solve it.. – JohnnyT Feb 8 at 15:37

1 Answer

If by "multiple attachments per entity" you mean that you have multiple binary columns in SQL table then I suggest you try to create StreamAccessor methods in your BCS Model for each column, see details here:

XML Snippet: Modeling a StreamAccessor Method

You can display links to the binary content in Business Data Web Part with custom XSLT like this:

<a>
  <xsl:variable name="downloadUrl" select="concat($DownloadExternalDataUrl, ddwrt:UrlEncode('BCSStreamAccessorMethodInstanceName'), '&amp;IsXmlEncodedStreamName=true&amp;ItemId=', @*[name()=$ColumnKey])" />
  <xsl:attribute name="href">
    <xsl:value-of select="$downloadUrl" />
  </xsl:attribute>
  <xsl:attribute name="onclick">javascript:DownloadExternalData('BCSStreamAccessorMethodInstanceName', '<xsl:value-of select="@*[name()=$ColumnKey]" />', '<xsl:value-of select="concat($downloadUrl, '&amp;InvisibleFrame=true')" />'); return false;</xsl:attribute>
  <xsl:value-of select="@tpar_binary_fname" />
</a>
<span style="display:none">
  <iframe>
    <xsl:attribute name="name">
      <xsl:value-of select="concat('BCSStreamAccessorMethodInstanceName', @*[name()=$ColumnKey], 'DownloadFrame')" />
    </xsl:attribute>
  </iframe>
</span>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.