Sunday, June 19, 2011

Show webpart custom property (PersonalizationScope.User) for Contribute users

Weeks ago in a project I added several custom webparts with one or more of the following custom properties:

[Category("Guisu properties")]
[Personalizable(PersonalizationScope.User)]
[WebDisplayName("Show Company")]
[WebBrowsable(true)]
public bool ShowCompany
{
get
{
return showCompany;
}
set
{
showCompany = value;
}
}


My idea was to have different levels of accessing these properties, so the administrator could see ALL the properties, including those with PersonalizationScope.Shared, and the users with Contribute permissions could only see the properties with PersonalizationScope.User. Moreover, according to MSDN, these properties should be user-specific.

Cool, huh? Well, it is not so easy. Thanks to this entry in http://akifkamalsyed.wordpress.com/ blog, I realized it is necessary to change several SafeControl entries.

This could be a problem for deployments... if we did not have the safe control entries configuration in VS2010 :) So the normal SafeControl properties for a default webpart are shown like this:




Just change them to the following configuration, redeploy, and it should work:

Thursday, June 9, 2011

New city, new country, new job...

Hi all,

So yes, it is true. I just left my job and my friends in BCN to move to Germany. That's why I have not been able to update the blog so often as I wanted (sorry to the 2 guys who have asked things about the Facebook API ;)).

Anyway, in the following days I will start to post again about SharePoint and (I hope) interesting technology stuff in my pseudo-English. Maybe I will use the blog to post funny things about Germany as well.

To sum up: I work right now for a small (but full of SharePoint experts) company called PlanB. There are a lot of people here that are very VERY good, so take a look to their blogs (some of them are in English and not in German :P).

Of course I would like to thank my previous workmates of Spenta for all the fun we had working together. It was a great time guys. I know the office will not be same after me, but you know, you will have to keep on living :D

That was enough for now... I have already a couple of posts in mind, so stay tuned.

Auf die Pl├Ątze, fertig, los!