0

I want to set the scope of the custom properties of visual web part so that every time user add the custom web part in different page in pages library, values can be changed for the properties and this should not effect the values set on other pages. The user adding the web part to different pages will be same. how can we achieve this? We can set the visual web part property scope as per user scope http://msdn.microsoft.com/en-us/library/office/ee550703(v=office.14).aspx.

0

The scope for user should work, just type the following code attribute when you declare the custom property:

[Personalizable(PersonalizationScope.User)]

Doesn't matter if a admin user creates the pages and add some webparts, SP will save the webpart properties for each specific user. But the user will need to update the properties for each webpart.

The properties are for each webpart so they shouldn't affect each other, even if you set "PersonalizationScope.Shared" each webpart should have its own property value, but it will be shared to all users.

  • actually the requirement is, user can not set the properties. only admin can set properties. if we will use PersonalizationScope.User then all the user will see same value for properties irrespective the webpart is added in different pages. – Harminder Singh Jul 22 '14 at 18:39
  • Oh ok, So in that way I don't see a point of using scopes on webpart properties... If you want a webpart to show a different behavior based on logged user (without user configuration), just get its information and then decide what to show... what is whole requirement? – agzertuche Jul 22 '14 at 20:46

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.