Search
Recent blog posts
- Feature Upgrade : Better to go for full solution deployment or for solution upgrade?
- Localizing XSL with the Business Data and the Content Query Webparts
- Leveraging oData using the built-in SharePoint 2010 data factory
- My top 10 tools for a better SharePoint development experience
- Forms Services 2007 => 2010 migration tip
- Potential gotcha with custom display forms
- Building and consuming a custom oData service for SharePoint 2010
- SharePoint 2010 - Overcome the 10000 default search results limit
- My Top 10 tests when testing custom SharePoint webparts
- Unexpected People Search results - the right way to fix it!
- My top 10 sanity checks when performing SharePoint code review
- DropBox for SharePoint now includes tagging to integrate better with SharePoint 2010 social framework
- SharePoint 2010, deploying a BCS Model using a farm property bag to have a dynamic siteurl
- SharePoint User Profiles + BCS + XML Serialization problems when data is not sanitized
- Releasing DropBox for SharePoint Server 2010
- Dashboard helper for the SharePoint developer dashboard
- Customizing the master page of Office 365 public site
- Office 365 customization, from excitation to frustration
- One step further with the BCS and the StreamAccessor
- Using the SharePoint Client Object model from within a custom Document Information Panel
- Using the SharePoint RESTful service listdata.svc from within a custom Document Information Panel
- cloudshare & SharePoint
- Easy Forms Designer for SharePoint Foundation
- 10 steps to make use of the Rating System for SharePoint Foundation
- Techdays 2011 in Paris
- New release of the rating system for SharePoint Foundation
- Manage the ribbon easily for your lists and libraries
- SPClaimsAuthMembershipProvider casting error
- using jQuery with ListData.svc and redirecting the user when not logged in using FBA
- SharePoint COM, client side error handling and impact on the performance + tips to handle returned error codes
User login
Checking the current user permissions on a list object via the Client Object Model
Hi,
In regular server-side SharePoint coding, when we want to check whether the current user has specific permissions on a list, we can use the method SPList.DoesUserHavePermissions(). This method isn't available from the Client Object Model but you can easily create your own this way:

You can use a similar technique with the Silverlight Client OM but you'll be forced to check asynchroneously!
Happy coding!
{
static ClientContext Ctx = null;
static void Main(string[] args)
{
Ctx = new ClientContext("http://intranet/sites/clients");
if (DoesUserHavePermissions("Clients", PermissionKind.AddListItems))
{
//User is a list contributor
}
}
static bool DoesUserHavePermissions(string listname, PermissionKind permmask)
{
List TargetList = Ctx.Web.Lists.GetByTitle(listname);
Ctx.Load(TargetList,T=>T.EffectiveBasePermissions);
Ctx.ExecuteQuery();
return TargetList.EffectiveBasePermissions.Has(permmask);
}
}