Problem Summary:
When I attempt to send an email with the invoice attachment using the Business Central API, I receive the following error:
You are not authorized to access this resource: https://graph.microsoft.com/.default. Contact your system administrator.
This error occurs only when trying to send the sales invoice via email. Other API calls, such as creating and sending electronic documents, work as expected.
Setup and Code Implementation:
Business Central Code:
I have written the following code in Business Central to send the sales invoice: