It helped a lot! I had problems at the beginning because I was filtering a specific message. I removed it from the filter and it worked for all messages. I also applied the Base64 tip. Thank you for sharing.
Insanely helpful video - can not thank you enough! Been banging my head against a wall for weeks trying to get this to work and this video finally made it happen. Only thing I did have to adjust at the end when you are setting the “download_attachment_endpoint” it needs (or mine did at least) a “/$value” at the end of that variable so I would get the actual file contents rather than just another JSON string. So helpful - thank you again!
Finally able to read my mailbox emails, the other tutorials show you only to oauth via browser to authenticate which is useless for service scripts. Thank you.
It's a great tutorial but in the last step you miss to convert the content of the response before witing the file. This could be a way (import base64): attachment_content = response.json()['contentBytes'] decoded_content = base64.b64decode(attachment_content) # Save the file with open(attachment_name, 'wb') as file: file.write(decoded_content) file.close() Bye
Really helpful !! Just wondering does that Mail.Read permission allow read all user mailboxes ? That is the permission very very hard to get unless you are an IT administrator.
Thank you for the step by step. I am new to python (former database admin with zero coding) and am having to google each line of code I am writing. This has been amazing. out of convenience, do you have a google drive or public github to access the code example?
when I tried to run the code, this message return {'error': {'code': 'ErrorAccessDenied', 'message': 'Access is denied. Check credentials and try again.'}}
why are you not getting a option on the browser to authorize the graphApi , is there a way to by pass that , so that we can run the script any time with a scheduler , without any intervention ?
my script does not have that browser auth thing, once you have the app secret, appclientid and tenantid hardcoded in the script, you can schedule it using windows task manager
@@bernardmwanza1628 Hello sir, at the moment i count all the permissions but im still getting this error "'message': 'Insufficient privileges to complete the operation", i need some special from de administrador o not? thx!
You can test the code, step by step, first very if u can get the access token, then next verify if u can get the entire json response for a particular resource instead of the custom filtered one.
@@bernardmwanza1628 followed same steps but geeting below error '401, {"error":{"code":"OrganizationFromTenantGuidNotFound","message":"The tenant for tenant guid 'ce0215a9-53fd-47c2-8b2d-8aeb16e17519' does not exist.","innerError
Absolutely amazing! Even MS Documentation doesn't illustrate this as easily
It helped a lot! I had problems at the beginning because I was filtering a specific message. I removed it from the filter and it worked for all messages. I also applied the Base64 tip. Thank you for sharing.
Insanely helpful video - can not thank you enough! Been banging my head against a wall for weeks trying to get this to work and this video finally made it happen. Only thing I did have to adjust at the end when you are setting the “download_attachment_endpoint” it needs (or mine did at least) a “/$value” at the end of that variable so I would get the actual file contents rather than just another JSON string. So helpful - thank you again!
Thanks scott5957, this fixed the unreadable files issue others have been noting.
Thank you. That was my other missing puzzle piece.
Finally able to read my mailbox emails, the other tutorials show you only to oauth via browser to authenticate which is useless for service scripts. Thank you.
It's a great tutorial but in the last step you miss to convert the content of the response before witing the file.
This could be a way (import base64):
attachment_content = response.json()['contentBytes']
decoded_content = base64.b64decode(attachment_content)
# Save the file
with open(attachment_name, 'wb') as file:
file.write(decoded_content)
file.close()
Bye
Thank you so much for adding this extra bit! I was pulling my hair out
This was extremely valuable in understanding how to work with the Graph API! Thank you so much for this content.
Really helpful !! Just wondering does that Mail.Read permission allow read all user mailboxes ? That is the permission very very hard to get unless you are an IT administrator.
Thank you for your help!
Thank you for the step by step. I am new to python (former database admin with zero coding) and am having to google each line of code I am writing. This has been amazing. out of convenience, do you have a google drive or public github to access the code example?
I think that's giving app permissions to every mailbox! Probably best to use delegated permissions and then authenticate on behalf of a user.
getting KeyError: 'value' for line 54
for attachment in attachments['value']:
hello Sir , great video , how can i get the code ?
I am getting an error as "/me request is only valid with delegated authentication flow." during subscription call.
How to download the file to specific folder path rather than the script place.
when I tried to run the code, this message return {'error': {'code': 'ErrorAccessDenied', 'message': 'Access is denied. Check credentials and try again.'}}
why are you not getting a option on the browser to authorize the graphApi ,
is there a way to by pass that , so that we can run the script any time with a scheduler , without any intervention ?
my script does not have that browser auth thing, once you have the app secret, appclientid and tenantid hardcoded in the script, you can schedule it using windows task manager
Can you please tell how to do that
I get unreadable files
you WOW
I am getting API response 403 what would I do?
that is a permission problem, you have not assigned your app registration correct permission to access the resources you are requesting.
@@bernardmwanza1628 Hello sir, at the moment i count all the permissions but im still getting this error "'message': 'Insufficient privileges to complete the operation", i need some special from de administrador o not? thx!
I am getting 401 error why this is coming
Your code. Is it correct
The same as your followed each step carefully but getting 401 error
Although 401 error is usually because of permission issue. Have u assigned and granted your app the correct application permission ?
You can test the code, step by step, first very if u can get the access token, then next verify if u can get the entire json response for a particular resource instead of the custom filtered one.
@@bernardmwanza1628 followed same steps but geeting below error
'401, {"error":{"code":"OrganizationFromTenantGuidNotFound","message":"The tenant for tenant guid 'ce0215a9-53fd-47c2-8b2d-8aeb16e17519' does not exist.","innerError
{'error': {'code': 'ErrorAccessDenied', 'message': 'Access is denied. Check credentials and try again.'
same mistake u.u
i get unreadable files