O365 / python-o365

A simple python library to interact with Microsoft Graph and Office 365 API
Apache License 2.0
1.65k stars 418 forks source link

Search emails #757

Open alexandruvesa opened 2 years ago

alexandruvesa commented 2 years ago

Hello ! I'm trying to search for the emails. After I successfully authenticated I receive this error: Client Error: 401 Client Error: Unauthorized for url: https://graph.microsoft.com/v1.0/users/f21748de002cfcb6/mailFolders/Inbox/messages?%24top=25 | Error Message: The tenant for tenant guid '487a2b09-f033-406b-a749-99a8d1774563' does not exist. Traceback (most recent call last): File "D:\anaconda3\envs\office365\lib\site-packages\IPython\core\interactiveshell.py", line 3361, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in <cell line: 1> inbox.get_messages() File "D:\anaconda3\envs\office365\lib\site-packages\O365\mailbox.py", line 212, in get_messages response = self.con.get(url, params=params) File "D:\anaconda3\envs\office365\lib\site-packages\O365\connection.py", line 811, in get return self.oauth_request(url, 'get', params=params, kwargs) File "D:\anaconda3\envs\office365\lib\site-packages\O365\connection.py", line 800, in oauth_request return self._internal_request(self.session, url, method, kwargs) File "D:\anaconda3\envs\office365\lib\site-packages\O365\connection.py", line 762, in _internal_request raise HTTPError('{} | Error Message: {}'.format(e.args[0], error_message), response=response) from None requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://graph.microsoft.com/v1.0/users/f21748de002cfcb6/mailFolders/Inbox/messages?%24top=25 | Error Message: The tenant for tenant guid '487a2b09-f033-406b-a749-99a8d1774563' does not exist.

The code snippet I use:

image

Thanks a lot

alejcas commented 2 years ago

The error says the tenant doesn't exist:

The tenant for tenant guid '487a2b09-f033-406b-a749-99a8d1774563' does not exist.