Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a SharePoint List in site. It has a custom list. I added a new field with type 'Multiple lines of Text' and in Additional Column Setting section selected 'Append Changes to the existing text'-->yes. When we modified list item we got the changes in that field only. How can we read the all the changes using .Net client object model.

Same problem we achieved in server object model like this way
public static string GetVersionedMultiLineTextAsPlainText(SPListItem item, string key)
{

StringBuilder sb = new StringBuilder();

foreach (SPListItemVersion version in item.Web.Lists[item.ParentList.ID].Items[item.UniqueId].Versions)
{

SPFieldMultiLineText field = version.Fields[key] as SPFieldMultiLineText;

if (field != null)
{

string comment = field.GetFieldValueAsText(version[key]);

if (comment != null && comment.Trim() != string.Empty)
{

sb.Append("");

sb.Append(version.CreatedBy.User.Name).Append(" (");

sb.Append(version.Created.ToString("MM/dd/yyyy hh:mm tt"));

sb.Append(") ");

sb.Append(comment + ';');

}

}

}

return sb.ToString();

}


same code need to write in .Net client object model.

Can any one help this code.
Posted
Updated 24-Oct-18 2:58am

1 solution

You can use below function:
JavaScript
function displayCostSheetComments() {
           $().SPServices({
               operation: "GetVersionCollection",
               async: true,
               strlistID: "yourListName",
               strlistItemID: "yourListItemId",
               strFieldName: "yourFieldnName",
               completefunc: function (xData, Status) {
                   $(xData.responseText).find("Version").each(function (i) {

                       var comments = {
                           User: $(this).attr("Editor").split(",#,#")[1],
                           Comments: $(this).attr("Comments"),
                           CommentDate: $(this).attr("Modified")
                       };
                       console.log("Name: " + $(this).attr("Editor") + $(this).attr("Comments") + " Modified: " + $(this).attr("Modified"));



                   });
               }
           });
       }
 
Share this answer
 
Comments
Richard Deeming 25-Oct-18 13:19pm    
The question was about using the .NET library to read the information, not Javascript.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900