开发者

How to make a SharePoint Web Part Property visible only to the Administrator?

How can i make a brows开发者_运维问答able web part property which should be visible only to the Administrator and not to the normal users ?


I was thinking you could do this by creating your own version of WebBrowsableAttribute, (eg AdminOnlyWebBrowsableAttribute) and decorating your property with the custom version.

However, unfortunately the WebBrowsableAttribute class is sealed.

The best alternative I can think of is to create your own EditorPart so that you can control which properties are available to each user,


Go to the modify Shared webpart and uncheck the property Allow Editing in Personal View which comes under advanced.


What attributes are you adding to the property being displayed in the editor? If you are only using [WebBrowsable(true)], the property will be personalizable for all users.

If you only want the property to be set by the admin in the shared scope, you should include a [WebPartStorage(Storage.Shared)] attribute.

See MSDN for more detail.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜