jjzjj

userPrincipal

全部标签

c# - 有没有办法为 UserPrincipal.FindByIdentity() 启用推荐追踪?

我有一个使用System.DirectoryServices.AccountManagement类的.NET3.5Web应用程序。当我搜索一些用户时,我得到一个PrincipalOperationException:服务器返回了推荐。如果我用我自己的LDAP代码以老派的方式执行此操作,我就可以启用追踪推荐。我需要重写我的代码吗?我的代码是这样的:using(varprincipalContext=newPrincipalContext(ContextType.Domain,null,adPath)){//Findtheprincipalobjectforwhichyouwishtoen

c# - 使用 PrincipalSearcher 查找参数为 "or"的用户

是否可以使用System.DirectoryServices.AccountManagement.PrincipalSearcher使用“或”(而不是“和”)基于多个参数进行搜索。即//Thisusesanand//(&(objectCategory=person)(!UserAccountControl:1.2.840.113556.1.4.803:=2)(&(SAMAccountName=tom*)(DisplayName=tom*)))varsearchPrinciple=newUserPrincipal(context);searchPrinciple.DisplayName=

c# - 使用 PrincipalSearcher 查找参数为 "or"的用户

是否可以使用System.DirectoryServices.AccountManagement.PrincipalSearcher使用“或”(而不是“和”)基于多个参数进行搜索。即//Thisusesanand//(&(objectCategory=person)(!UserAccountControl:1.2.840.113556.1.4.803:=2)(&(SAMAccountName=tom*)(DisplayName=tom*)))varsearchPrinciple=newUserPrincipal(context);searchPrinciple.DisplayName=

c# - 如何获取 UserPrincipal 类未表示的 Active Directory 属性

我的意思是,现在我正在使用System.DirectoryServices.AccountManagement,如果我使用UserPrincipal类,我只会看到名称、中间名等所以在我的代码中它就像UserPrincipalmyUser=newUserPrincipal(pc);myUser.Name="aaaaaa";myUser.SamAccountName="aaaaaaa";....myUser.Save();如何查看移动或信息等属性? 最佳答案 在这种情况下,您需要更深入一层-回到DirectoryEntry的内部-通过从

c# - UserPrincipals.GetAuthorizationGroups 枚举组时发生错误 (1301)。升级到 Server 2012 域 Controller 后

研究:SimilarIssuewithworkaround,butnotactualsolutiontoexistingproblemSimilarissuepointingtoMicrosoftEndPointupdateasculprit上面的链接最适合我的问题,我在创建这篇文章时也查看了StackOverflow列出的每个类似问题,只有上面引用的问题适合我的问题。背景:两年半以来,我一直在使用UserPrincipal.GetAuthorizationGroups获取在C#.NET4.0Web表单站点的Server2008R2上运行IIS7.5的特定页面访问权限。2013年5月1

c# - .NET 4.5 UserPrincipal.FindByIdentity (System.DirectoryServices.AccountManagement) 中的错误

在.NET4.5下测试我们的.NET4.0应用程序时,我们遇到了UserPrincipal的FindByIdentity方法的问题。以下代码在.NET4.0运行时中运行时有效,但在.NET4.5下失败:[Test]publicvoidTestIsAccountLockedOut(){conststringactiveDirectoryServer="MyActiveDirectoryServer";conststringactiveDirectoryLogin="MyADAccount@MyDomain";conststringactiveDirectoryPassword="MyAD

c# - 给定 UserPrincipal 对象,如何从 Active Directory 获取 "Company"和 "Department"?

这可能吗?代码示例会很好。 最佳答案 实际上,问题是如何获取.NET3.5(System.DirectoryServices.AccountManagement.)UserPrincipal对象的两个属性,但未给定userPrincipalName。这里是如何用extensionmethod做到这一点的:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.DirectoryServices;usingSys

关于 c#:UserPrincipal SamAccountName throws DirectoryServicesCOMException unhandled “A local error has occurred”

UserPrincipalSamAccountNamethrowsDirectoryServicesCOMExceptionunhandled"Alocalerrorhasoccured"我正在编写一段代码,它应该根据他们的SamAccountName作为搜索参数在活动目录中搜索特定用户GivenName(forename)和Surname,然后返回一个包含他们的名字和姓氏的字符串.目前我写的代码如下:123456789101112131415161718192021publicstaticstringGetName(stringuName)  {    StringBuilderbuilde

关于 c#:UserPrincipal SamAccountName throws DirectoryServicesCOMException unhandled “A local error has occurred”

UserPrincipalSamAccountNamethrowsDirectoryServicesCOMExceptionunhandled"Alocalerrorhasoccured"我正在编写一段代码,它应该根据他们的SamAccountName作为搜索参数在活动目录中搜索特定用户GivenName(forename)和Surname,然后返回一个包含他们的名字和姓氏的字符串.目前我写的代码如下:123456789101112131415161718192021publicstaticstringGetName(stringuName)  {    StringBuilderbuilde
12