A couple of things to look out for:
- Permissions: Ensure you have the right permissions to access user profile photos. For Delegated Permissions it is User.Read and for Appication Permissions, the least required is User.Read.All- (Documentation)
2.User photo: Make sure the user has a profile photo set. If the user does not have a profile photo, the API call will return an error.
- User Metadata: You can use the $select statement to view specific metadata. Metadata is not supported for Personal Microsoft Accounts as stated in the documentation.
- Version: Try and also run this request on Graph Explorer and see if the issue persists. You can also check your permissions on Graph Explorer. You can also run in V1 since this is available in V1.