Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebBrowsable vs Personalizable in Web Parts

What is the difference between the attributes WebBrowsable and Personalizable in a Sharepoint 2010 web part?

e.g.

[Personalizable(), WebBrowsable]
public string IconURL { get; set; }

vs

[WebBrowsable]
public string IconURL { get; set; }

MSDN gives the impression that personalizable is per user, whereas webbrowseable is for all users - however it doesn't explicitly mention this and I would like to get this sorted in my head.

E.g. can I set a user specific property on personalizable and web-part wide on webbrowsable?

like image 469
Darbio Avatar asked Dec 06 '10 00:12

Darbio


1 Answers

The WebBrowseable attribute specifies that the decorated property should appear in the editor component of the web part. It only allows the end user to modify the property and does nothing about persistence.

The Personalizable attribute specifies that the value of the decorated property must be persisted in the SharePoint backend, either in the user store (by default) or in the shared store (if the Shared scope is specified). It only cares about persistence and does nothing about the property presence in the editor component.

So, if you decorate a property with [WebBrowsable] and not [Personalizable], the end user will be able to modify it in the editor component but its new value won't be persisted.

Conversely, if you decorate a property with [Personalizable] and not [WebBrowsable], its value will be persisted but the end user won't be allowed to modify it.

like image 184
Frédéric Hamidi Avatar answered Oct 27 '22 15:10

Frédéric Hamidi