I have a custom webpart in which I get the SPUser object from email address, see the code below. It was working fine for like an year now , but since yesterday it gives a
"User cannot be found"
error. There was no change made in the code or anywhere else. And I checked in the User Information List whether those email addresses exists and they do. I do understand what is causing this error. Any suggestion on were to look is appreciated.
Here is the line that's causing problem now:
spUser = spWeb.SiteUsers.GetByEmail(txtEmail.Text);
I also tried checking through powershell by the following method. In this case I am getting some of the users correctly. but for some other users email addresses I tried, it returns the same
"user cannot be found" exception.
$user = $web.Users.GetByEmail("firstname.lastname@example.org")