sharepoint 2013 userprofile 用户信息
2015-07-14 16:46
399 查看
Sharepoint2013获得当前用户userfrofile
基本介绍:
什么使用户配置文件。 用户属性和用户配置文件属性提供有关 SharePoint 用户的信息,如显示名称、电子邮件、标题以及其它业务和个人信息。开发人员能够通过获得该文件,也能够改动文件、创建文件。Sharepoint2013确实是个开发好工具,能够通过javascript对象模型、.NETclient对象模型、服务期端对象模型。这里用server对象模型解决。
实现:
得到当前用户: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
相关文章推荐
- HBase change split policy on an existing table
- Java获取客户端的真实IP地址
- Android ImageView组件
- js、php、html的几种跳转方式
- Node:RMQ问题之ST算法
- 公司管理体会
- NYOJ - 586 疯牛
- 真机iOS 系统升级后xcode不能进行真机调试
- nginx中connection概念
- 六、离散化
- 根据excel模版导出数据到excel
- MySql数据库用户的创建,删除和查看
- Android ImageView组件
- 4G+:比光纤还要快的手机网络
- eclipse 开发spark程序找不到reduceByKey操作
- 每天一个linux命令(12):more命令
- android 获取mac地址
- Eclipse导入Android项目的正确方法
- 使用FreeMarker将数据模型中的值合并到模板文件中
- SUI