C# 使用目录服务从Active Directory域/AU获取所有用户

C# 使用目录服务从Active Directory域/AU获取所有用户,c#,.net,directoryservices,principalcontext,C#,.net,Directoryservices,Principalcontext,我的代码正确地创建了一个列表(结果),其中所有用户的名字都包含James 如何更改代码以使结果包含域/ou中的所有用户 // create your domain context and define the OU container to search in PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "YYYYYY", "OU=XXXXXX,OU=ZZZZ Exchange")

我的代码正确地创建了一个列表(结果),其中所有用户的名字都包含James

如何更改代码以使结果包含域/ou中的所有用户

        // create your domain context and define the OU container to search in
        PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "YYYYYY", "OU=XXXXXX,OU=ZZZZ Exchange");

        List<UserPrincipal> searchPrincipals = new List<UserPrincipal>();
        searchPrincipals.Add(new UserPrincipal(ctx) { Name = "*James*" });

        List<Principal> results = new List<Principal>();
        var searcher = new PrincipalSearcher();

        //add results to list
        foreach (var item in searchPrincipals)
        {
            searcher = new PrincipalSearcher(item);
            results.AddRange(searcher.FindAll()); ;
        }

更改SearchPrincipal.Add(新用户主体(ctx){Name=“**”});添加(新用户主体(ctx));谢谢博多纳塔,这确实是答案。
searchPrincipals.Add(new UserPrincipal(ctx) { Name = "**" });