1

We have migrated our site to SharePoint Modern experience from classic. For that we had to replace the Script Editor with the React Script Editor, as Script editor is no longer available in modern experience. Now, we are trying to validate the document/page links after migration by fetching the ServerProcessedContent property for all web parts by using SharePointPnPCoreOnline:

  using (ctx = authMgr.GetSharePointOnlineAuthenticatedContextTenant(siteUrl, userName, password))
  {
    web = ctx.Web;
    //loading sharepoint web instance  
    ctx.Load(web);
    ctx.ExecuteQueryRetry();
    sitePagesList = web.Lists.GetByTitle("Site Pages");
    CamlQuery query = new CamlQuery();
    query.ViewXml = "<View><Query><OrderBy><FieldRef Name = 'ID'/></OrderBy></Query></View>";

    var allItems = sitePagesList.GetItems(query);

    ctx.Load(allItems, eachItem => eachItem.Include(i => i["DisplayName"]));
    ctx.ExecuteQuery();
    foreach (var i in allItems)
    {

      ctx.Load(i, I => I.File, I => I.DisplayName);
      ctx.ExecuteQueryRetry();
      file = i.File;
      file.EnsureProperty(x => x.Name);
      var page = ClientSidePage.Load(ctx, file.Name);
      var webParts = page.Controls.FindAll(c => c.Type.Name == "ClientSideWebPart");

      if (webParts != null && webParts.Count > 0)
      {
        foreach (var webpart in webParts)
        {
          try
          {
            clientSideWebPart = (ClientSideWebPart)webpart;
            // This is the property we are trying to get
            JObject jsonObject = clientSideWebPart.ServerProcessedContent;

          }
          catch (Exception ex) { }
        }
      }
    }
  }

We are able to get the value for all other webparts, but for React Script Editor there are no results in the ServerProcessedContent property:

{"htmlStrings":{},"searchablePlainTexts":{},"imageSources":{},"links":{}}

I tried to do it with CSOM but it didn't work either. Am I missing something or is there a different way to get the content for react script editor?

Thanks

1 Answer 1

0

ServerProcessedContent property of React Script Editor is an empty object. You can verify its value from the workbench:

enter image description here

BR

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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