SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|improve this question
up vote 0 down vote accepted

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.

share|improve this answer
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. – Jaap Vossers 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.

share|improve this answer

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.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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