web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Trying to send invoice via an API call... not authorized

(1) ShareShare
ReportReport
Posted on by 14
Hi
 
I'm trying to automate sending invoices via the API by posting to the following URL:
 
https://api.businesscentral.dynamics.com/v1.0/{tenantId}/api/v2.0/companies({companyId})/salesInvoices({salesInvoiceId})/Microsoft.NAV.Send
 
This executes successfully and returns "204 No Content", however no email is produced.
 
When reviewing the "Job Queue Log Entries" I can see an error relating to the API call:
 
 
The error message says: 
 
You are not authorized to access this resource: https://graph.microsoft.com/.default. Contact your system administrator.
 
I think the problem is that the App Registration does not have the correct permissions to send the email via the shared mailbox configured.  I have granted several Microsoft.Graph permissions including Application.ReadWrite.All and Mail.Send and still have not had any success, which makes me think there could be a configuration in BC I need to do.
 
If anyone else has encountered this and come up with a solution please let me know?  Thank you
I have the same question (0)
  • Suggested answer
    Anthony Blake Profile Picture
    2,926 Super User 2025 Season 2 on at
    Hi Alan,
     
    Mail.Send & User.Read should be enough API permissions to send email from a shared mailbox, I set this scenario up this week, albeit from D365 Finance.
     
    User.Read should be assigned by default, but make sure it hasn't been removed.
     
    Also check that the API permissions are not awaiting administrator approval in Azure.
     
    Anthony
  • Suggested answer
    YUN ZHU Profile Picture
    95,331 Super User 2025 Season 2 on at
    This looks like a permissions issue with OAuth authentication.
    Please check your App Registration permissions.
     
     
    Thanks
    ZHU
  • Gerardo Rentería García Profile Picture
    25,213 Most Valuable Professional on at

    Hi, good day
    I hope this can help you, and give you some hints.

    Using OAuth to connect Business Central APIs and Web Service in Postman | Dynamics 365 Lab

    Best Regards
    Gerardo

  • Suggested answer
    Alan Shurey Profile Picture
    14 on at
    Thank you for the suggestions, however I found the app registration permissions were not the issue.
     
    The call to the bound action (Microsoft.NAV.Send) was working correctly, however the email account bound to the sales invoice cannot handle the Application Registration as the user and the app permissions do not appear to be passed through to allow access to the mailbox.  Instead of using Exchange I managed to configure an SMTP email account to go out via Sendgrid (which allows me to set a basic username and password).
     
    The problem for me is that Exchange is locked down to MFA users so I cannot use basic authentication.  Not sure if this is the best solution, however its worked for me so I'm happy.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans