Search code examples
office-jsoffice365apiazure-ad-graph-apioutlook-restapisharepoint-rest-api

Microsoft Graph API Javascript SharePoint Access


Is it possible to access Microsoft Graph via REST from SharePoint Online to pull in user properties and send emails after you have been authenticated within the domain? I only have SCA access for our SharePoint Online environment and would like to give users the ability to send emails from a custom form on the page. However, I do not want the email to come from noreply-sharepointonline.com. I do not have tenant administrator access to register the "application". It is just js running within a script editor web part. If it cannot be done with Graph can it be done with the Outlook API or any other method? My main concern is the ability to send emails via REST as the rest of the information I can get using the JSOM or SharePoint Online REST API.


Solution

  • I would look at two components. Since you're already using a script editor web part I would look at how to build SharePoint Framework solutions. That's the modern framework for building in-page components that work in both modern and classic SharePoint pages. You can get started here. One caveat is that to deploy a SharePoint Framework solution you will need an admin to either deploy the solution globally or give you a Site Collection App Catalog that you can deploy to yourself.

    Second, yes Microsoft Graph should allow you to do what you're looking to accomplish. You can use Microsoft Graph from within a SharePoint Framework web part and make the necessary calls. You're likely going to want to look at the docs for Mail and Users