You can use the Microsoft.SharePoint.Client.Utilities.Utility.ResolvePrincipal method. For example:
Web web = context.Web;
string email = "[email protected]";
PeopleManager peopleManager = new PeopleManager(context);
ClientResult<PrincipalInfo> principal = Utility.ResolvePrincipal(context, web, email, PrincipalType.User, PrincipalSource.All, web.SiteUsers, true);
context.ExecuteQuery();
Then to get the login name from the resulting principal (if found), and get the user properties
if (principal.Value != null)
{
System.Console.WriteLine("Found user. LoginName is: '" + principal.Value.LoginName + "'");
PersonProperties personProperties = peopleManager.GetPropertiesFor(principal.Value.LoginName);
context.Load(personProperties, p => p.AccountName, p => p.UserProfileProperties);
context.ExecuteQuery();
}
else
{
System.Console.WriteLine("User with email '" + email + "' not found.");
}
See MSDN for the ResolvePrincipal method documentation: Utility.ResolvePrincipal method. Full code example:
Web web = context.Web;
string email = "[email protected]";
PeopleManager peopleManager = new PeopleManager(context);
ClientResult<PrincipalInfo> principal = Utility.ResolvePrincipal(context, web, email, PrincipalType.User, PrincipalSource.All, web.SiteUsers, true);
context.ExecuteQuery();
if (principal.Value != null)
{
System.Console.WriteLine("Found user. LoginName is: '" + principal.Value.LoginName + "'");
PersonProperties personProperties = peopleManager.GetPropertiesFor(principal.Value.LoginName);
context.Load(personProperties, p => p.AccountName, p => p.UserProfileProperties);
context.ExecuteQuery();
}
else
{
System.Console.WriteLine("User with email '" + email + "' not found.");
}
GetPropertiesFor
method, it should be login name or account name