在infopath中通过C#代码获取AD中的用户信息
来源:百度知道 编辑:UC知道 时间:2024/07/06 20:06:09
不要建议说新建一个数据库,这种方式现在在我的项目中行不通。
什么?!!这么简单的问题 快四年了都没人解决? 算了 我这个初学者来回答:
using (SPSite site = new SPSite("你的sharepoint网站地址"))//正式发布的时候这里要改!!
{
ServerContext context = ServerContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(context);
UserProfile u = profileManager.GetUserProfile(this.Application.User.LoginName);
string preferredName = u[PropertyConstants.PreferredName].Value.ToString();
string workEmail = u[PropertyConstants.WorkEmail].Value.ToString();
string title = u[PropertyConstants.Title].Value.ToString();
string departMent = u[PropertyConstants.Department].Value.ToString();
}
用到了服务器端对象模型,需要引用sharepoint.ll以及其他相关文件,具体可以联系我!
这么专业的问题还是查阅相关的SDK吧
session[""]。。。
把用户名,密码,状态,权限什么的全用session保存