سؤال

I have a community site with a discussion board and I would like to display a few of the latest posts on my main start-up page?

How would one go about it in SharePoint 2013?

هل كانت مفيدة؟

المحلول

The proposed solution allows to modify Discussion List web part properties that are not available from UI.

Enable web part Export capabilities

In order to modify web part properties that are not available from UI, we need to enable Export capabilities:

  • Add Discussions List on the page.
  • Open the page in SharePoint Designer (SPD)
  • Find the property ExportControlledProperties and set its value to True in order to enable web part Export capabilities
  • Save the page in SPD

Change web part properties

From now the export action have to be available as shown on picture below enter image description here

Assume we need to display the 4 latest discussions.

Discussion default view (Subject) has the following properties:

<RowLimit Paged="TRUE">20</RowLimit>

In order to change these properties follow the steps below:

  • Export web part file
  • Find the property XmlDefinition and change RowLimit element Paged attribute to FALSE and value to 4
  • Upload and add web part on page

Result

enter image description here


How to display Discussions using CQWP

In order to aggregate Discussions from a different site you could utilize Content Query web part (CQWP).

Steps:

  • add Content Query web part (located under Content Roollup category)
  • go to web part settings and specify the Querysettings as shown on picture below
    enter image description here
  • and specify Sorting settings as shown on picture
    enter image description here

نصائح أخرى

Here is a List Style I found that made the CQWP work properly.

<xsl:template name="DiscussionStyle" match="Row [@Style='DiscussionStyle']" mode="itemstyle">
  <xsl:variable name="DisplayTitle">
   <xsl:call-template name="OuterTemplate.GetTitle">
    <xsl:with-param name="Title" select="@Title"/>
    <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
   </xsl:call-template>
 </xsl:variable>
 <table cellpadding="3" cellspacing="3" width="100%">
  <tr>
   <td class="S2StyleTitle" colspan="2">
    <xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>
    <a href="{@LinkUrl}" title="{@LinkToolTip}" style="font-size:11px;">
     <xsl:value-of select="$DisplayTitle"/>
    </a>
   </td>
  </tr>
  <tr class="S2StyleBorder">
   <td class="S2StyleDescription" valign="top">
    <span style="color:#808080"><strong>Posted</strong>:
     <xsl:value-of select="@PubDate"/>
    </span>
   </td>
  </tr>
 </table>
</xsl:template>

How to Configure a Custom Item Style for a Discussion Board using the Content Query Web Part

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top