I am working on a remote event receiver, and i want to reference a mail-enabled security group using the email, i tried this:-

User pmoGroup = context.Web.SiteUsers.Where(a => a.Email.ToLower().StartsWith("pmo@")).SingleOrDefault();

now this security group is already added to a SharePoint group, so it should be inside the siteUsers (inside the user info hidden list), but my above code will get null value for the pmoGroup. any advice?

1 Answer 1


Instead of accessing the siteusers, can we iterate all the users from the "User Information List" as below and from that can we take the pmogroup,

ClientContext clientContext = new ClientContext("http://your site/");
Web web = clientContext.Web;
List siteUserInfoList = web.SiteUserInfoList;
CamlQuery query = new CamlQuery();
query.ViewXml = "";
IEnumerable<ListItem> itemColl = clientContext.LoadQuery(siteUserInfoList.GetItems(query));
foreach (var item in itemColl)
    Console.WriteLine("ID:{0}  Email:{1} Title:{2}", item.Id, item["EMail"], item["Title"]);
   if(item["EMail"]!= null){
       var userValue = (FieldUserValue)item["Name"];
       var user = clientContext.Web.GetUserById(userValue.LookupId);
       clientContext.Load(user, x => x.LoginName);
       string thisWillBeUsersLoginName = user.LoginName;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.