Monthly Archives: December 2011

Programmatically checking if a user belongs to an SharePoint Audience

The following code will check if a user belongs to a given Audience in SharePoint using (SPSite elevatedSite = new SPSite(Microsoft.SharePoint.SPContext.Current.Site.ID)) { SPServiceContext serviceContext = SPServiceContext.GetContext(elevatedSite); AudienceManager audManager = new AudienceManager(serviceContext); Audience audience = audManager.GetAudience(“AudienceToCheck”); SPUser user = SPControl.GetContextWeb(Context).CurrentUser; if

Tagged with:
Posted in SharePoint, Uncategorized

Disable SharePoint ribbon control based on user list permissions

I had a requirement to create a button on a SharePoint list ribbon that was only enabled for Contributors of that list. The post will explain how to set that up in javascript using the SharePoint 2010 Client Object Model.

Tagged with: , , ,
Posted in Uncategorized