Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This is one of the regular discussion that comes across at my desk, how we can configure Hybrid Exchange on-premise server integration with Office 365/Exchange Online, so that users can make use of REST API. So I thought let me stitch all of them together which can be handy for both the Exchange administrators and REST API developers as well. This is a deep dive one stretching from administration, configuring, testing the API calls as well.
Exchange On-Prem 2016 Server CU3 + Office 365 + REST API integration:
Microsoft Graph has always provided access to customer mailboxes in the cloud on Exchange Online as part of Office 365. Exchange 2016 Cumulative Update 3 (CU3), released in September 2016 for Exchange on-premises servers, adds support for REST API integration with Office 365. If your app uses v1.0 of the Mail, Calendar, or Contacts API, you will now also find a seamless authentication and application experience in hybrid deployments, regardless of whether the mailbox is on-premises or in the cloud, provided that the deployment meets specific requirements.
Requirements for the REST API to work in hybrid deployments:
[Update] Please refer the post to get additional info for Exchange/Office 365/Azure Administrators - Virtual directory, Auto discover, HCW:
Behind the scenes:
So, when Microsoft Graph identifies that a REST API call is attempting to access an on-premises mailbox in a hybrid deployment, it proxies the REST request to an on-premises REST endpoint which then processes the request. This discovery makes accessing the REST API possible.
Let’s do a detailed hands-on Exchange on-premise Server integration with Office 365/Exchange Online and play/the REST API calls:
Come learn how you can now use Microsoft Graph to reach on-premises and cloud users of hybrid Exchange 2016 deployments, in addition to Office 365 and Outlook.com. We'll discuss how your application can handle versions of servers on-premises and in the cloud, and how on-premises Exchange 2016 is set up to support Microsoft Graph and OAuth.
In addition, you can refer another related video (yes, definitely hands-on as well. It’s Level 300 training video, contains 75 minutes – but worth watching):
In this we will discuss how you set set up on-premises Exchange 2016 to support applications developed built on easy-to-use REST APIs, and how your application should handle versions of servers in cloud and on-premises.
Related resources for IT administrators:
Related resources for Graph API developers:
But you need to aware that (when you test the above hybrid scenario),
- The ability to use these REST APIs in hybrid deployments is currently in preview.
- Only v1.0 of the Mail, Calendar and Contacts API are available for mailboxes in hybrid deployments.
- Other v1.0 API sets, such as the Groups API, or APIs in other versions, are not available.
- If you attempt to use an API that is not part of the supported set in a hybrid deployment, you will get the following error message: "REST APIs for this mailbox are currently in preview. You can find more information about the preview REST APIs at https://dev.outlook.com."
Hope this helps.
https://graph.microsoft.com/v1.0/users('onpremuser@onpremdomain.com')/messages/
) using graph api it fails by providing UnknownError.Below is error from IIS.66. GENERAL_SET_RESPONSE_HEADER HeaderName="x-ms-diagnostics", HeaderValue="2000001;reason="This token profile 'V1S2SAppOnly' is not applicable for the current protocol.";error_category="invalid_token"", Replace="false" 05:55:17.54567. GENERAL_SET_RESPONSE_HEADER HeaderName="WWW-Authenticate", HeaderValue="Bearer client_id="00000002-0000-0ff1-ce00-000000000000", token_types="app_asserted_user_v1 service_asserted_app_v1", error="invalid_token"", Replace="false" 05:55:17.54568. AspNetPipelineLeave Data1="Microsoft.Exchange.Security.OAuth.OAuthHttpModule"And decoded token looks like below.{ "aud": "https://graph.microsoft.com/", "iss": "https://sts.windows.net/ea6064aa-d6fc-48d3-abb8-1728e1f39e0b/", "iat": 1552816830, "nbf": 1552816830, "exp": 1552820730, "aio": "42JgYAh75eXH75Ns8W0nl9uMrXa2AA==", "app_displayname": "newtestapp", "appid": "fb461318-f95f-474f-9451-ad6b9952a5fe", "appidacr": "1", "idp": "https://sts.windows.net/ea6064aa-d6fc-48d3-abb8-1728e1f39e0b/", "oid": "301eb6c0-478a-407c-9493-7fa40c4cf9bc", "roles": [ "Mail.ReadWrite", "Mail.Read", "Mail.Send" ], "sub": "301eb6c0-478a-407c-9493-7fa40c4cf9bc", "tid": "ea6064aa-d6fc-48d3-abb8-1728e1f39e0b", "uti": "VsBgeqI930a5YR8SvTFVAA", "ver": "1.0", "xms_tcdt": 1550570031}However if authorization code grant or resource owner password credential (ROPC) grant type used to obtain token , I was able to get messages of on prem user using graph API. How to make client credentials grant work for on-prem user messages access using graph API (in hybrid setup) ? I have gone through multiple blogs and done lot of googling but nothing helped. Everything works perfectly for cloud users for client credentials grant flow. Only for on prem issue is seen.Requesting you to provide some help or direction.
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in