显示用户名 [英] Show User name

查看:95
本文介绍了显示用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近创建了一个见解应用程序,因此可以从本地SharePoint环境中获取数据.
到目前为止,我获得了很多数据,但是令人讨厌的一件事是,即使我很难成功配置SharePoint应用程序以将使用情况数据提供给应用程序见解,我仍然看不到实际的用户名,只有一个没用的用户名userID看起来有些东西 像这样:  njQBs

I have recently created an insights application, so fetch data from my on-prem SharePoint enviroment.
So far so good, I am getting alot of data, but one annoying thing, is that even tough I have successfully configured my SharePoint applications to feed usage data to app insights, I still can't see the actual user name, only a useless userID looking something like this: njQBs

显然这不是很有用,但是没有人知道如何显示实际的用户名吗?

Obviously this is not very usefull, but does anyone know how to get the actual username to show? 

我已经尝试了很多不同的东西,并且我看到许多文章都在谈论在global.asax文件中包含某种C#代码,但是他们并没有真正详细地解释这是如何完成的.

I tried alot of different stuff already, and I see many articles talking about including some kind of c# code to the global.asax file, but they don't really explain in detail how this is done.

这是最接近于解释如何实现此目标的文章,但对于像我这样的人,细节却不知如何添加此类东西:

This is the article that comes the closest to explaining how to achieve this, but details are missing, for someone like me, that has no idea how to add this kind of stuff:

http://eriksteinebach.com/2016/12/26/Follow-a-specific-user-with-Application-Insights-by-setting-AuthenticatedUserId/

http://eriksteinebach.com/2016/12/26/Follow-a-specific-user-with-Application-Insights-by-setting-AuthenticatedUserId/

我也尝试过这样做,但是那didint可以做任何事情:

I also tried this out, but that didint do anything either:

https://docs.microsoft.com/zh-CN/azure/application-insights/app-insights-sharepoint

https://docs.microsoft.com/en-us/azure/application-insights/app-insights-sharepoint

希望这里的某人对我如何进行这项工作有一些想法.

Hope someone in here has some ideas as to how I can make this work.


mic

推荐答案

你好迈克尔,

SetAuthenticatedUserContext()是实现此目的的正确方法.您极有可能需要在跟踪页面视图之前将其添加到SharePoint母版页的AI脚本中,并设置此方法以通过以下方法的第三个参数删除用户Cookie: 该方法(如果您的网站可以删除非必要的Cookie,并且已经将其通知用户了):

SetAuthenticatedUserContext() is the right way to achieve this. You will, most likely, need to add it to the SharePoint master page into AI script right before tracking page view and set this method to drop a user cookie as well via the third parameter of that method (if your site is OK with dropping non-essential cookies and already notifies user about it):

setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string, storeInCookie = false)

应该可以解决问题.


这篇关于显示用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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