The WebPartPages Web service includes actions to get or save Web Part properties (GetWebPart, SaveWebPart). Both require a unique identifier called storageKey.

When using Web services on the client side (JavaScript/jQuery), how can I retrieve this storageKey?



The Storage key is a guid. The value of it is the same as the value of WebPartID attribute of the div representing the web part.

  • I tried in SP Foundation and it didn't work for me. When I use WebPartID as storageKey, I get the following message: The operation could not be completed because the Web Part is not on this page.
    – Christophe
    Sep 22 '10 at 16:38
  • Try calling SaveWebPart() Web Service method and see if the return value matches the WebPartID attribute on the div. msdn.microsoft.com/en-us/library/ms774839(v=office.12).aspx Sep 22 '10 at 20:17

This Web Service has horrible documentation, even worse than the others. As I remember when I played around with it, I could get information about the Web Parts on the page with GetWebPartPage first.


You can send your web part ID to you javascript when the page is loaded.


Guid ((Microsoft.SharePoint.WebPartPages.SPWebPartManager)WebPartManager).GetStorageKey(this);

As for saving your web part properties, instead of going through SOAP you could create a service that uses the SPLimitedWebPartManager using the storage key.

Something like this should work.

        using (SPWeb web = new SPSite(webUrl).OpwnWeb()){
    using (SPLimitedWebPartManager manager = GetLimitedWebPartManager(PublishingWeb.IsPublishingWeb(web) ? PublishingWeb.GetPublishingWeb.DefaultPage.Url : web.RootFolder.WelcomePage, System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared))
    WebPart part = manager.WebParts[storageKey];
//Do web part stuff.

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.