We are using the following end point of the SharePoint Online API go get the ID of the user in SharePoint:
('xxx@my_company')/Id
In most of the cases (90% of the cases) this function works fine and it return the ID. But in some cases the below error is shown:
<m:error xmlns:m=";>
<m:code>-2130575276, Microsoft.SharePoint.SPException</m:code>
<m:message xml:lang="en-US">User cannot be found.</m:message>
</m:error>
I don't know the reason of the above message, because the user account (and email) is a standard and working user account in the company. After some time (days or weeks), if I test again the same function for the same account it works. I think there are something that the end user enables automatically and unconsciously, when he/she start using the systems, login process, etc. We don't make any manual operation in the user account.
Is somebody experincing the same trouble? Some fix or reason ideas?
Thanks in advance.
Check user account in Entra. Check all licenses, groups and permissions.