in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

Sander's Blog

Showing attachments in a Content Query Webpart

Not quite that complicated, but I'm it sure can save you (and myself next time) some time.

To show the attachment paperclip in your CQWP, just add this section to the xsl:template in the ItemStyle.xsl:

<xsl:choose>
    <xsl:when test="@Attachments='1' or msxsl:string-compare(string(@Attachments),'Yes','','i')=0 or msxsl:string-compare(string(@Attachments),'N0','','i')=0">
        <img src="_layouts/images/attach.gif" border="0" alt="Attachment"></img>
    </xsl:when>
    <xsl:otherwise>
        <!-- message no attachments attached -->
       </xsl:otherwise>
</xsl:choose>

Secondly, export the webpart and add the Attachment field to the commonviewfields:

<property name="CommonViewFields" type="string">Attachments,Attachments;</property> 
Published Dec 10 2007, 03:03 AM by Sander de Koning
Filed under:

Comments

 

Michael Gannotti said:

Timely post :-)

December 10, 2007 5:31 AM
 

SharePoint, SharePoint and stuff said:

OT: Dateiverzeichnisse synchronisieren mit SyncToy Microsoft SyncToy 2.0 Beta Artikel zu den Dokument-Konvertern

December 11, 2007 11:02 AM
 

Links (12/11/2007) « Steve Pietrek’s SharePoint Stuff said:

Pingback from  Links (12/11/2007) &laquo; Steve Pietrek&#8217;s SharePoint Stuff

December 11, 2007 8:44 PM
 

Louis said:

Great post, but what can I do to show the the attachment as a image and not the famous paperclip?

December 19, 2007 4:31 AM
 

Louis said:

Great post, but what can I do to show the the attachment as a image and not the famous paperclip?

December 19, 2007 4:31 AM
 

Louis said:

Great post, but what can I do to show the the attachment as a image and not the famous paperclip?

December 19, 2007 4:31 AM
 

Tim said:

Great stuff, but do you know if you can get the filename(s) for the attachments as well as the number?

Thanks

Tim

February 1, 2008 6:43 AM
 

Sander de Koning said:

Hi Tim, I'm afraid thats not possible.

The only 'knowledge' a list item has is whether there is an attachment..

You can check the xml output of the CQWP for that: In your CQWP web part properties task pane, if you check the box titled enable feed for this web part, you should get a little RSS icon at the bottom of your CQWP output that gives you an XML version of your data.

February 1, 2008 7:18 AM

Leave a Comment

(required )  
(optional )
(required )  
Add

Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts