是否可以使用Word插件获取当前用户名?

问题描述 投票:0回答:2

我正在开发一个 Microsoft Word 插件,它将代表当前用户向 Word 文档添加注释。我似乎找不到动态获取当前用户名称的方法,有什么办法可以做到这一点吗?

ms-word office-js office-addins word-addins
2个回答
0
投票

有一项预览功能,在预览结束之前,我们不建议您在生产加载项中使用该功能。但它将使您能够从 Azure AD 获取包含用户名、电子邮件和 ID 的令牌。文档从这里开始:Office 加载项中的 SSO


0
投票
Word.run(async (context) => {
  const documentProperties = context.document.properties;
  documentProperties.load("author");
  await context.sync();
  console.info("Author:", documentProperties.author);
)}
© www.soinside.com 2019 - 2024. All rights reserved.