我正在根据 Office.js
为Outlook和Desktop One开发加载项。在Addin中,我希望选项可以通过单击在新窗口中保存过的电子邮件(其ID)打开它们。为此,我需要使标识符不可变。要使标识符变动,我需要使用图形API。
更优选的是,此。
https://graph.microsoft.com/v1.0/me/translateExchangeIds
但是,这是一个使用此方法的问题,我需要在该请求的标题中传递授权令牌。
问题是如何获得所需的图形API授权令牌使用Office.js功能?
我尝试了什么令牌:
- 使用
office.auth.getAccessToken()
,但由于请求我得到了在我的在线Outlook中的错误 - 此平台中不支持API
。
- 使用
office.auth.getAccessToken()
,但我获得了相同的结果 - API在此平台中不支持
- 使用
offick.context.mailbox.getCallbackTokenAsync()是的,我得到了结果令牌,但是如果您在Graphs API请求标题中传递此令牌,则它会在控制台中丢下错误(不良授权令牌)
I am developing add-in based on office.js
for Outlook and desktop one. In addin I want option to saved previusly emails(their id ) open them in new window by click. For that I need to make identifiers immutable. To make identifiers immutable I need to use GRAPH API.
More preferably this POST method to transform dynamic IDs to constant ones.
https://graph.microsoft.com/v1.0/me/translateExchangeIds
But here is a problem to use this method I need authorization token to be passed in headers of that request.
Question is how to get needed GRAPH API authorization token using office.js functional?
What tokens I tried:
- Using
Office.auth.getAccessToken()
but as result of request I got error in my online outlook - API is not supported in this platform
.
- Using
Office.auth.getAccessToken()
but I got same result - API is not supported in this platform
- Using
Office.context.mailbox.getCallbackTokenAsync()
yeah I got as resultat token, but if you pass this token in GRAPHS API request headers then it throws error in console what request was bad (bad Authorization token)
发布评论
评论(1)
要了解
单登录(SSO)
在Office附加组件中的工作方式,我建议创建一个新的示例加载项并在调试器下运行代码。该过程记录在指南。另外,您可能会发现有帮助的示例加载项“>示例加载项”。getAccessToken
方法调用Azure Active Directory v 2.0端点,以获取访问加载项的Web应用程序的访问令牌。启用加载项可以识别用户。 Server-side code can use this token to access Microsoft Graph for the add-in's web application by using theTo understand how the
Single Sign-On (SSO)
works in Office add-ins I'd suggest creating a new sample add-in and run the code under the debugger. The process is documented in the Single sign-on (SSO) quick start guide. Also you may find the sample add-in which uses SSO helpful.The
getAccessToken
method calls the Azure Active Directory V 2.0 endpoint to get an access token to your add-in's web application. Enables add-ins to identify users. Server-side code can use this token to access Microsoft Graph for the add-in's web application by using the "on behalf of" OAuth flow. This API requires a single sign-on configuration that bridges the add-in to an Azure application. Office users sign-in with Organizational Accounts and Microsoft Accounts. Microsoft Azure returns tokens intended for both user account types to access resources in the Microsoft Graph.