Deploy Resource Files in SharePoint…


While doing SharePoint projects definitely you will have to use resource files to well mange and localize your resources. Not like an ASP.net application SharePoint requires you to deploy resource files to different locations.

To be clear, different operations will look the resource files in two different locations(Web parts refer one location and the resource entries in a feature manifest file looks in another etc…). The two resource locations SharePoint will look into are,

1) C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Resources\

2) The web application Virtual Directory (typically C:\inetpub\wwwroot\wss\VirtualDirectories\ {the web application port number}\App_GlobalResources\

So when we deploy a solution what typically done is coping the resource files to these locations manually.
 
How to overcome these manual steps?
Continue reading

Show Hide Existing Ribbon Options / Commands…


Once I wanted to hide some ribbon options for a given permission set. Basically, in SharePoint 2010 the rich text content area allows to insert web part directly on it. I wanted to security trim so, only the users that has Contributor permission level or higher would be able to perform the web part insert.

While figuring out how to do this, I came across an option that, to create a new custom control to perform the show hide ribbon options.

1) Create a custom control (inheriting from System.Web.UI.Control)

2) Override the OnPreRender method

3) Retrieve the ribbon from the current viewing page.

SPRibbon ribbon = SPRibbon.GetCurrent(Page);

Continue reading