我正在开发一个SharePoint 2010的Web部件(在C#),这需要从活动目录中获取用户数据,但我使用的是当前SharePoint用户的凭据进行身份验证有麻烦广告。我使用DirectoryEntry类从AD获取数据,当我对某些凭证进行硬编码时,它工作正常,但我知道这是不好的做法,所以我想避免它。我试着像情侣不同的东西:使用当前用户的SharePoint凭证来获得Active Directory访问
new DirectoryEntry("LDAP://" + dc, null, null, AuthenticationTypes.ServerBind | AuthenticationTypes.FastBind);
和
new DirectoryEntry("LDAP://" + dc, null, null, AuthenticationTypes.Secure);
,但他们都只是抛出异常。我真的不知道这些做什么,但这是我在网上找到的。
任何帮助,可以指向我在正确的方向将不胜感激。
你已经配置档案服务?您可以利用它来使用SharePoint对象模型获取用户数据。 – ukhardy 2011-02-23 12:10:04