1

Is there any way to update the Modified field in Office 365? I have checked both CSOM and Batch update methods. But it's failed. Could anybody help me to update this field.

1

SharePoint CSOM API does not support system update (SystemUpdate method counterpart from SSOM API) but you could manipulate system fields like Modified By and Modified fields directly as demonstrated below.

Prerequisites: SharePoint Server 2013 Client Components SDK

using (var ctx = GetContext(webUri, userName, password))
{
    //get List Item
    var list = ctx.Web.Lists.GetByTitle(listTitle);
    var item = list.GetItemById(itemId);
    //Retrieve User
    var user = ctx.Web.EnsureUser(accountName);
    ctx.Load(user);
    ctx.ExecuteQuery();
    //Update system fields
    item["Modified"] = DateTime.Now.AddMonths(-6);
    item["Created"] = DateTime.Now.AddYears(-1);
    item["Editor"] = user.Id;
    item["Author"] = user.Id;
    item.Update();
    ctx.ExecuteQuery();
}

where

public static ClientContext GetContext(Uri webUri, string userName, string password)
{
    var securePassword = new SecureString();
    foreach (var ch in password) securePassword.AppendChar(ch);
    return new ClientContext(webUri) { Credentials = new SharePointOnlineCredentials(userName, securePassword) };
}

Follow System update for SharePoint list items using App model article for a more details

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.