如何从任务窗格应用程序获取用户名,电子邮件地址,文件名 [英] How to get username, email address, filename from task pane app
问题描述
我试图从任务窗格应用程序(Office加载项)中获取以下信息:
- 用户信息,即用户名,电子邮件地址
- 当前打开的文档的文件名
我目前正在为Word,Excel和PowerPoint以及Outlook应用程序开发一个任务窗格.请告知.
上次在开发人员预览版中发布了单点登录(SSO).作为系统的一部分,您的加载项从Office主机应用程序获取一个包含"preferred_username"属性的令牌.该属性的值是登录Office的用户的电子邮件.
有两个示例:
在两个示例中,加载项还使用从Office主机接收到的令牌来获取对Microsoft Graph的访问令牌,但是您的加载项不必采取额外的步骤.
我不知道任何不使用SSO来获取用户身份的方法.
I cam trying to get the following information from the task pane app (Office Add-ins):
- User information ie. username, email address
- Filename of the current open document
I'm currently developing an task pane add in for Word, Excel and PowerPoint, as well as an Outlook app. Please advise.
Single sign-on (SSO) was released in developer preview last week. As part of the system, your add-in gets a token from the Office host application that contains a "preferred_username" property. The value of the property is the email of the user logged into Office.
There is an overview at Enable single sign-on for Office add-ins (preview).
There are two samples:
In both samples, the add-in also uses the token received from Office host to get an access token to Microsoft Graph, but your add-in doesn't have to take that extra step.
I don't know of any way of getting the user identity without using SSO.
这篇关于如何从任务窗格应用程序获取用户名,电子邮件地址,文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!