Persisting web part properties with PersonalizationScope.Shared

This question has suggested answer(s) This question has suggested answer(s)

I have created WSS 3.0, MOSS 2007, SharePoint Foundation 2010 and SharePoint Enterprise 2010 web parts with a bevy of custom properties to set. With the aforementioned platforms everythings persists as you would expect.


However, with the online SharePoint instance for the 365 beta, bool fields are not being persisted using the same method that has been working for me. Interestingly, text fields persist just fine.


Here is how I mark a boolean field:


private bool _showWorkspaces = true;






Category("My Category")]

public bool ShowWorkspaces


    get { return _showWorkspaces; }

    set { _showWorkspaces = value; }



The above field will display correctly in the web part editor 'backpage', and I can even adjust the settings and the new value will flow through to the web part correctly. However, when I call up the web part editor again, all bool fields will be 'false'.


Let me know if you would like more information.




All Replies
  • I am sorry to hear you are having issues with your custome web parts. Since we do not support custom code, I've gathered a couple of resources which may be helpful in answering your questions. In terms of the issue itself, since we don't support custom code, it would be a "best effort" scenario of support.  Meaning that if the answer isn't something very clear that we can see right away, we would not be able to dig into the issue any further.  Here are the aforementioned links to the resources. I do apologize we aren't able to dig into this issue any further. Best of luck with your research.

    SharePoint Online for Office 365: Developer Guide

    Microsoft Office 365 Beta Deployment Guide for Enterprises

  • Hi Mike,

    Thank you for the links but I couldn't find an answer in them. We noticed that while the boolean custom properties exhibited this odd behavior, text and dropdown fields worked as expeted. So we created a 'Boolean Enum' instead. It's a bit clunkier than simply clicking in a checkbox, but at least the values persist.

    Here's our writeup on it with screenshots:

    Otherwise we are very pleased with how our silverlight gantt chart is working within SharePoint online. It's a great user experience to simply upload our WSP file and activate it. Nice job!