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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值