question

LeonMatch-3740 avatar image
0 Votes"
LeonMatch-3740 asked SaurabhSharma-msft edited

How to use Outlook Mail API in Web App

Hello,
We have a Web App build with Oracle Apex.
We are using Azure AD for users authentication. Our App already registered in Azure.

We need to open Outlook Email from Web App and pass email's Title, To and Cc values, and an Attachment.
We prefer to open Outlook Email in a modal window or new browser window.

I read Outlook Mail API documentation but still can't figure out how to do all these API calls from our Web App?
We are trying to follow JavaScript example from this article:
https://docs.microsoft.com/en-us/graph/api/user-sendmail?view=graph-rest-1.0&tabs=javascript

It is not clear which URL user will need to click to invoke the API and open Outlook Email?

Also we probably need to create JSON POST request. How to do that in a Web App with Javascript?
Is there any end to end examples for that with Javascript?

Need a push in a right direction please.

Thank you!



azure-active-directory
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

SaurabhSharma-msft avatar image
0 Votes"
SaurabhSharma-msft answered SaurabhSharma-msft edited

You can use Microsoft Graph SDK for Javascript which provides various features to enhance working with all Microsoft Graph Services with less complexity. You can find the steps to follow, code snippets and how to use the library over here. Basically, you need to register your application in Azure AD and provide necessary Microsoft Graph permissions to the registered application to perform various graph operations.

This page also provides few samples and tutorials to start with.


Additionally, you can refer to the documentation here to learn more on using REST for Outlook API.

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

All these examples always miss one last point - which URL user has to click to invoke the API call and open Email?

Our App already registered in Azure.

Did you use the steps you suggested yourself?

Thanks.

0 Votes 0 ·

Microsoft Graph SDK's and REST endpoints doesn't open an Outlook window. You need to pass the values from your code. For you requirement you can create your own modal page where user can enter title, subject and add attachment and when submitted you can use the SDK or API to create send the mail using the context of logged in user if this works for you.

0 Votes 0 ·

@SaurabhSharma-msft
Not really. Our users want to use Outlook to compose their messages. And we need to pass To, CC, Subject and Attachment to the message.

Can we do it with Outlook Mail API, Graph, etc.. ? And how?

Thank you!

0 Votes 0 ·
Show more comments