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 Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,876 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RajeshKumarMSFT 1,971 Reputation points Microsoft Vendor
    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