sharepoint 2013 userprofile 用户信息

Sharepoint2013获得当前用户userfrofile

简介:

什么使用户配置文件, 用户属性和用户配置文件属性提供有关 SharePoint 用户的信息,如显示名称、电子邮件、标题以及其他业务和个人信息。开发者可以通过获得该文件,也可以修改文件、创建文件。Sharepoint2013确实是个开发好工具,可以通过javascript对象模型、.NET客户端对象模型、服务期端对象模型。这里用服务器对象模型解决。

实现:

得到当前用户:

stringLoginName=System.Web.HttpContext.Current.User.Identity.Name.ToString();

得到更多信息:

  SPSecurity.RunWithElevatedPrivileges(delegate{

SPSite _site = SPContext.Current.Site;

                SPServiceContext serverContext = SPServiceContext.GetContext(_site);

                UserProfileManager myUserProfile = newUserProfileManager(serverContext);

                UserProfile currentUserProfile= myUserProfile.GetUserProfile(SPContext.Current.Web.CurrentUser.LoginName);

string departmentName = (string)currentUserProfile["department"].Value;

//所属部门

string phoneNsumber= (string)currentUserProfile["workphone"].Value;

//电话号码

string emailAddress= (string)currentUserProfile["workEmail"].Value;

//电子邮箱地址

})

总结

就介绍这么多了,如果想更多了解,这是msdv地址:

http://msdn.microsoft.com/ZH-CN/library/office/jj163182(v=office.15).aspx

时间: 2024-07-29 12:29:41

sharepoint 2013 userprofile 用户信息的相关文章

sharepoint站点获取用户打开和下载文档操作的信息

相关资料收集: 1,SharePoint 位置记录上的操作:https://msdn.microsoft.com/zh-cn/library/gg334567(v=crm.6).aspx 2,开启sharepoint2007文档稽核功能,记录文档开启(下载),修改等用户及时间和其他信息:http://blog.csdn.net/abrahamcheng/article/details/3131915 3,介绍 SharePoint 2010 中的记录管理功能:http://blogs.msdn.

在移动设备上优化SharePoint 2013站点

本文由SPFarmer翻译自Waldek Mastykarz的文章 移动市场在持续的增长,在不远的将来,使用移动设备浏览网站将会超过电脑.为了保证用户友好的体验,我们必须优化网站,以便在不同的设备上展示.SharePoint 2013 提供了一系列的选项来优化在移动设备上访问面向公众的网站.根据你的实际情况,你可以选择一个或者一系列组合的选项. 在过去的几年里,使用移动设备浏览网站得到了极大的增长.据一些研究者说,到2015年,使用移动设备访问网站会超过电脑.移动设备有不同的尺寸和功能.因为电脑

SharePoint 2013 一些小技巧

一.添加"SharePoint 2013 切换用户"标签 相比SharePoint 2010,SharePoint2013版本去掉了切换用户登陆的功能(如下图),其实这个可以通过改welcome.ascx控件来显示出来: 修改文件的位置,如下图: 文件位置 C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES welcome.ascx截图 可能报

SharePoint 2013取得关注用户和用户关注的信息

SharePoint 2013取得关注用户和用户关注的信息 1. 取得关注该用的人 static void GetFollowedUsers(string userName,string siteUrl) { using(SPSite site = new SPSite(siteUrl)) { SPServiceContextcontext = SPServiceContext.GetContext(site); UserProfileManagerprofileManager = new Us

SharePoint 2013 数据库中手动更新用户信息

在SharePoint的使用过程中,尤其是Windows认证的情况下,而且没有配置用户配置文件服务,经常会出现如果更新AD中的用户信息(包括名字.显示名.邮件等),SharePoint这边站点并不会更新的情况. 这时候,我们经常会操作数据进行更新操作,生产环境建议备份,测试环境也要多看几次update语句. 1.首先进入授权的用户组,看到我们的用户名,当AD中更新,这里的Name还是之前的名字,如下: 2.鼠标放到名字上,可以看到Url链接地址,这时候我们需要ListId和ID,ListId是用

Sharepoint 2013 通过Secure Store Service获取用户信息

1.在用Secure Store Service获取用户信息之前需要配置SSS. 2.以下代码是获取用户信息: using (SPSite site = new SPSite(webUrl)) { SecureStoreProvider prov = new SecureStoreProvider(); SPServiceContext context = SPServiceContext.GetContext(site); prov.Context = context; //current u

在SharePoint 2013中显示“以其他用户身份登录”

在我新建了SharePoint 2013的网站后, 发现界面与2010有一些不同,比如缺少了"以其他用户身份登录",这给我的测试带来很大不便. 在找了一些国外网站后,终于找到了解决方法 第一步:找到welcome.ascx文件,在"C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES" 第二步:添加以下代码到welcome.a

SharePoint 2013 表单认证使用ASP.Net配置工具添加用户

前 言 上面一篇博客,我们了解到如何为SharePoint 2013配置表单身份认证,但是添加用户是一个麻烦事儿:其实,我们还可以用Asp.Net的配置工具,为SharePoint 2013添加表单用户,下面让我们简单介绍下,如何操作. 打开Visual Studio,新建项目,选择Asp.net web application类型,如下图: 点击OK,进入选择模板页面,如下图: 创建完毕,双击打开web.config,如下图: 添加数据库连接串,连接的是我们表单认证的数据库,不要写错了,如下图

sharepoint 2013 设置 显示详细错误信息

1. 在当前网站端口目录下的Web.config修改 例如80端口的站点路径为:C:\inetpub\wwwroot\wss\VirtualDirectories\80 (1)将<customErrors mode="On" /> 修改成 <customErrors mode="Off" /> (2)将<SafeMode MaxControls="200" CallStack="false"  修