如何从任务窗格应用程序获取用户名,电子邮件地址,文件名 [英] How to get username, email address, filename from task pane app

查看:111
本文介绍了如何从任务窗格应用程序获取用户名,电子邮件地址,文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从任务窗格应用程序(Office加载项)中获取以下信息:

  1. 用户信息,即用户名,电子邮件地址
  2. 当前打开的文档的文件名

我目前正在为Word,Excel和PowerPoint以及Outlook应用程序开发一个任务窗格.请告知.

解决方案

上次在开发人员预览版中发布了单点登录(SSO).作为系统的一部分,您的加载项从Office主机应用程序获取一个包含"preferred_username"属性的令牌.该属性的值是登录Office的用户的电子邮件.

启用单个登录Office加载项(预览).

有两个示例:

Office-Add-in-ASPNET-SSO

Office-Add-in-Nodejs-SSO

在两个示例中,加载项还使用从Office主机接收到的令牌来获取对Microsoft Graph的访问令牌,但是您的加载项不必采取额外的步骤.

我不知道任何不使用SSO来获取用户身份的方法.

I cam trying to get the following information from the task pane app (Office Add-ins):

  1. User information ie. username, email address
  2. 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:

Office-Add-in-ASPNET-SSO

Office-Add-in-Nodejs-SSO

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆