various shenanigans.

Sharepoint 2010 Email-Enabled Discussion List Content Query Web Part

I had a recent request to allow supervisors to post “kudos” emails to a Sharepoint site for display on a “dashboard.”

They did not want it to be labor intensive by having to logon and copy/paste email content to a list.

To achieve this I created an email-enabled discussion list. This part is key as email-enabled document libraries keep the content of the email as an attachment. Discussion lists keep the email content in the body of the list.

I added a Content Query Web Part to my page, set it up to query the discussion list and then exported that for modification.

This is the change to the CQWP:

<property name="CommonViewFields" type="string">Body,RichText;
DiscussionLastUpdated,DateTime;</property>

This pulls in the Body and Date fields. I then added a custom ItemStyle for my display.

<xsl:template name="Kuds" match="Row[@Style='Kuds']" mode="itemstyle">
       <xsl:variable name="SafeLinkUrl">
            <xsl:call-template name="OuterTemplate.GetSafeLink">
                 <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
           </xsl:call-template>
       </xsl:variable>
       <xsl:variable name="DisplayTitle">
            <xsl:call-template name="OuterTemplate.GetTitle">
                <xsl:with-param name="Title" select="''"/>
                <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
                <xsl:with-param name="UseFileName" select="1"/>
            </xsl:call-template>
       </xsl:variable>
          <table border="0">
          <tr>
          <Td style="background-color:#C0E2EF">
                  <xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>
               <a href="{$SafeLinkUrl}" title="{@LinkToolTip}">
                   <xsl:if test="$ItemsHaveStreams = 'True'">
                     <xsl:attribute name="onclick">
                       <xsl:value-of select="@OnClickForWebRendering"/>
                     </xsl:attribute>
                   </xsl:if>
               <xsl:if test="$ItemsHaveStreams != 'True' and @OpenInNewWindow = 'True'">
                     <xsl:attribute name="onclick">
 <xsl:value-of disable-output-escaping="yes" select="$OnClickTargetAttribute"/>
                     </xsl:attribute>
                   </xsl:if>
                  <div style="font-size:10pt"><xsl:value-of select="$DisplayTitle"/></div>
               </a>
          </Td>
         </tr>
          <tr>
<td style="border-bottom:2px black solid">
<div style="font-size:6pt;font-style:italic">
<xsl:value-of disable-output-escaping="yes"  select="@DiscussionLastUpdated"/></div>
</td>
</tr>
<tr>
<td style="border-bottom:1px gray solid">
<xsl:value-of disable-output-escaping="yes"  select="@Body"/>
</td>
</tr>
</table>
</xsl:template>

End result – The Subject line is highlighted in blue with the date posted underneath. The Body of the email follows below.



		
Close Bitnami banner
Bitnami