Authentication Problems Using the Office 365 API

可紊 提交于 2019-11-30 18:11:05

问题


My goal is to get the user's (Office 365 and Outlook.com) meetings for a given day in a WPF C# project. Following the steps described in the Outlook Dev Center Tutorial, the second step (after registering the app) would be to authenticate the user using OAuth2. But I cannot make it work:

  • I did not find any tutorial/code snippet which I was able to run. They are all written either for Apps or Asp.Net (or something else). I tried to adapt these, but without success...
  • I installed the Active Directory Authentication Library (ADAL) and Microsoft Office 365 Mail, Calendar and Contacts Library via Nuget.
  • I also don't want to use an Azure subscription, just to read some meetings. And I think it's also not necessary for my purpose as they say it's only important for advanced management.
  • When I try to obtain a token with the credentials which I got from the Application Registration Portal, I get: Application '<id>' is not supported for this API version.. Looking the error up on StackOverflow tells me to register the application, which is what I did.
  • When I try to obtain a token with the credentials from the Office App Registration Portal, I get: Application with identifier '<id>' was not found in the directory outlook.office365.com.
  • Documentation is really confusing to me, with many different APIs (Graph API, 365 API, etc.) and many dead pages in the documentation...

I'd really appreciate any pointers towards my goal.


回答1:


If you want to be able to get items from Outlook.com as well as O365 outlook, you should use the new v2.0 app model. You will find useful documentation here : https://azure.microsoft.com/en-us/documentation/articles/active-directory-v2-app-registration/

You should read the limitations here: http://azure.microsoft.com/documentation/articles/active-directory-v2-limitations/

While you can use any Microsoft account to register applications, not all Microsoft accounts have been enabled for the REST APIs. To request an Outlook.com developer preview account with the REST APIs enabled, send an email at outlookdev@microsoft.com

Finally if you want a sample to log in within a desktop application, check this tutorial : https://azure.microsoft.com/en-us/documentation/articles/active-directory-v2-devquickstarts-wpf/



来源:https://stackoverflow.com/questions/34145989/authentication-problems-using-the-office-365-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!