Showing posts with label Multiline text field. Show all posts
Showing posts with label Multiline text field. Show all posts

Thursday, March 1, 2012

Show all versions of multiline text field (Appended text)

1. Open site with SharePoint Designer and Insert a DataView WebPart(DVWP) on a page including your multiline field.
2. Switch to codeview and find the line that reference the field. (need to replace - <xsl:value-of select="@Comments" disable-output-escaping="yes" />

3. Replace with:

<SharePoint:AppendOnlyHistory runat="server" FieldName="Comments" ControlMode="Display" ItemId="{@ID}"/>

You will see the all the comments with author and dates.

To get all the versions for Multiline text field

allComments = "";
foreach (SPListItemVersion versionListItem in item.Versions)
{
        if (versionListItem["Comments"] != null){
               allComments += versionListItem["Comments"].ToString();
        }
}