I am using UserProfilePropertiesForUser class to pull SharePoint profile properties of the user. However for some users, i am receiving user not found exception. I have just checked on the SharePoint site and can find the user even through check permissions.

Can someone please guide me what could be the possible root cause of this issue that i am getting user not found exception but the user can access the SPO site. I am also attaching the code and error screenshot for the reference.

var usr = context.Web.SiteUsers.GetByEmail("[email protected]");

After the execute query call, i am getting the below exception. enter image description here Regards, Tayyab

1 Answer 1


SiteUsers will return you the user if user as visited the SharePoint list at least once. This is because it looks into UserInformationList which is present in every site collecction. You can try Graph API instead .

import { graph } from '@pnp/graph';
import '@pnp/graph/users';

const getUser = await graph.users.getById('[email protected]')();
  • 2
    The other possible solution would be "ensure user" before get it. Sep 3, 2020 at 15:39
  • 1
    "... if user has visited the SharePoint list at least once..." or permissions was assigned to user directly (not via group) as I remember it right. Sep 3, 2020 at 15:39
  • @Akshay: Thank you for adding details about how SiteUsers call works and sharing the Graph API solution. Sep 4, 2020 at 6:00
  • @VIadilen: Awesome, ensure user call worked for me, appreciate your help. Sep 4, 2020 at 6:00

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.