-
Notifications
You must be signed in to change notification settings - Fork 251
Description
Hi,
I've been trying to figure this out for a while now and I can't figure out where the problem is.
I want to use the MS Graph Api to fetch a shared mailbox.
The app in Entra ID is registered and has the required permissions. Currently even more than it actually needs due to tests.
I actually wanted to access it via a secret, but then switched to DeviceCode for a quick PoC.
I think I get access to the API but get the following error message back.
$ parsedmarc -c parsedmarc.ini
0it [00:00, ?it/s] ERROR:cli.py:1561:Mailbox Error
Traceback (most recent call last):
File "C:\Workspace\parsedmarc\.venv\Lib\site-packages\parsedmarc\cli.py", line 1539, in _main
reports = get_dmarc_reports_from_mailbox(
connection=mailbox_connection,
...<12 lines>...
since=opts.mailbox_since,
)
File "C:\Workspace\parsedmarc\.venv\Lib\site-packages\parsedmarc\__init__.py", line 1618, in get_dmarc_reports_from_mailbox
messages = connection.fetch_messages(
reports_folder, batch_size=batch_size, since=since
)
File "C:\Workspace\parsedmarc\.venv\Lib\site-packages\parsedmarc\mail\graph.py", line 152, in fetch_messages
folder_id = self._find_folder_id_from_folder_path(folder_name)
File "C:\Workspace\parsedmarc\.venv\Lib\site-packages\parsedmarc\mail\graph.py", line 245, in _find_folder_id_from_folder_path
return self._find_folder_id_with_parent(folder_name, None)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "C:\Workspace\parsedmarc\.venv\Lib\site-packages\parsedmarc\mail\graph.py", line 257, in _find_folder_id_with_parent
raise RuntimeWarning(f"Failed to list folders.{folders_resp.json()}")
RuntimeWarning: Failed to list folders.{'error': {'code': 'ErrorItemNotFound', 'message': 'The specified object was not found in the store., Default folder Root not found.'}}
0it [00:00, ?it/s]
When I switch to a Secret, I get an Access Denied as expected.
RuntimeWarning: Failed to list folders.{'error': {'code': 'ErrorAccessDenied', 'message': 'Access is denied. Check credentials and try again.'}}
I have also tried using my own mailbox instead of a shared mailbox but always get the same error.
Also the creation of the standard folders for archives and co do not fit. Customizing the report folder to different versions of Inbox/INBOX or for the German Local “Posteingang” does not change this error.
If I look correctly, the error is only triggered if the URL call does not return 200 when checking the folder.
Here is my "mini" config
[mailbox]
test = true
reports_folder = Inbox
[msgraph]
#auth_method = ClientSecret
auth_method = DeviceCode
client_id = XXXXXXXXX
#client_secret = XXXXXXXXX
#tenant_id = XXXXXXXX
user = <user UPN for Office365>
mailbox = [email protected]
[general]
save_aggregate = true
output = C:\Workspace\parsedmarc\output
aggregate_output_format = html, csv
Any ideas?