Can i send email in python using delegated permissions from microsoft graph api ?

tapan gupta 1 Reputation point
2021-08-13T18:36:25.86+00:00

Hi,

I am using microsoft graph api to send emails in python but i only have delegated permissions. i am getting errors.

So is it possible to send using delegated permissions or i need application permissions.

Please clear this confusion.

Thank you so much !
Tapan

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RajeshKumarMSFT 1,976 Reputation points Microsoft External Staff
    2022-03-09T14:25:18.733+00:00

    Hi @tapan gupta ,

    Hope you are doing well,

    To send email with Graph API in Python you can use MSAL for Python to achieve the same. You need to provide Application Permissions to Microsoft Graph while registering your application instead of using Delegated permissions and required to provide an Admin Consent to required permissions to make it work.

    In your python code you need to pass account parameter as none like acquire_token_silent(config["scope"], account=None) as you are required to get token for the client and you do not need to provide the redirection URI. Refer

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.