I have few content editor web parts in my page

I need to get the GUID of all the web parts that are there in the page

I am able to get the list of all webparts in the page by navigating to


I couldnt find the GUID's of the webparts, how can i get them using REST/CSOM or any other client side method?

1 Answer 1


Using JSOM

 var clientContext = new SP.ClientContext(_spPageContextInfo.webServerRelativeUrl);
    var oFile = clientContext.get_web().getFileByServerRelativeUrl(_spPageContextInfo.serverRequestPath);
    var limitedWebPartManager = oFile.getLimitedWebPartManager(SP.WebParts.PersonalizationScope.shared);
    var collWebPart = limitedWebPartManager.get_webParts();

    clientContext.executeQueryAsync(Function.createDelegate(this, function () {
        var webPartDef = null;
        for (var x = 0; x < collWebPart.get_count() && !webPartDef; x++) {
            var temp = collWebPart.get_item(x);
            if (temp.get_id().toString() === wpId) {
                webPartDef = temp;
        if (!webPartDef) {
            dfd.reject("Web Part: " + wpId + " not found on page: " + _spPageContextInfo.webServerRelativeUrl);

        var webPartProperties = webPartDef.get_webPart().get_properties();
        clientContext.executeQueryAsync(Function.createDelegate(this, function () {
            dfd.resolve(webPartProperties, webPartDef, clientContext);
        }), Function.createDelegate(this, function () { dfd.reject("Failed to load web part properties"); }));
    }), Function.createDelegate(this, function () { dfd.reject("Failed to load web part collection"); }));

    return dfd.promise();


Using REST


You can get webpartcollection using the webpartmanager.WebPartManager control acts as the hub or control center of a Web Parts application.

There must be one and only one WebPartManager control instance on every page that uses Web Parts controls.

  • 1
    Thanks Amit Anyway that can be done via clientside code? Commented Jun 16, 2015 at 5:28
  • 1
    See my edited answer
    – Amit Kotha
    Commented Jun 16, 2015 at 5:40
  • Thanks Amit, upvoted Will try this out :) Commented Jun 16, 2015 at 5:53

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.