Wednesday, July 2, 2014

How to get count of group of current login user if AD Group is added in SharePoint Group?

My Client has 2 SharePoint Application. For the AD Users they have created AD Group and added users in that AD Group as per requirement. Later AD Group is added in SharePoint Group. When I'm trying to fetch Current User Group count, I can able to get the count of Groups using below statement.



int groupCount = SPContext.Current.Web.CurrentUser.Groups.Count;



Above Statement, returns always 0 value if I tried with User who are added in AD Group and if I add AD User and then it will return the exact count.


Please suggest solution to get Count of Group of Current User. My Application contains more than 60 SharePoint group.



No comments:

Post a Comment