I want to read e-mail and calendar event from gmail in SharePoint apps (provider hosted or SharePoint hosted), with current username and password. i have configured SSO between Azure AD and Google for work and able to login to Gmail Apps using azure AD user credentials. now i am stuck with how to fetch gmail email and calendar using azure ad credentials in SharePoint Provider Hosted Apps or SharePoint Hosted Apps
i able to solve this problem. i used google service account to fetch data from Gmail and calendar. below are steps
- go to console.developer.google.com.
- create service account and store certificate file.
- enable your domain wide delegation for your service account.
- it will create client id for your service account.
- go to admin console -> security -> manage api page
- give access to https://mail.google.com and https://calendar.google.com and add your client id in client name
- once done create web API which will use your certificate and access gmail and calendar
- access your web api using ajax in sharepoint to fetch gmail and calendar data.