I need to get roles for current user(like visitors,contributors,administrators etc.) from sharepoint 2010. I am using Silverlight client object model to deal with sharepoint 2010 API.
Kindly share your knowledge.
thanks & regards
Here is a sample code to get the groups in Silverlight app by calling the GetGroupCollectionFromUserAsync method of UserGroup.asmx web service.
http://www.innovawiz.com/get-the-sharepoint-groups-a-user-is-part-of-using-sharepoint-object-model
Why don't you explore possibilities of SharePoint Web services? I think you can reach your goal much easier by using web services then by using Client Object Model.
Take a look at UserGroup Web Service and its method UserGroup.GetRoleCollectionFromUser Method. I believe this method to be exactly what are you looking for.
Here you can find one example: https://stackoverflow.com/questions/1213459/determining-users-role-in-a-sharepoint-site-workspace-using-the-webservices-api
And here is explanation how to consume SharePoint Web Services from Silverlight: http://blogs.msdn.com/b/kaevans/archive/2009/04/28/sharepoint-for-developers-part-4-consuming-sharepoint-web-services-from-silverlight.aspx