Skip to main content
added 449 characters in body
Source Link
Bassist
  • 41
  • 1
  • 7

I have to populate my autocomplete PeopleEditor-like control based on brililant ASPTokenInput with all people from my AD domain. Reflecting PeopleEditor shows a real mess in their Active Directory search engine and all potentially helpful classes are internal.

My test method works fine, but I need to get ALL users from AD(not sharepoint site ones) to populate my list: How it looks

public string GetUsers(string filter)
    {
        var spWeb = SPContext.Current.Web;
        SPUserCollection allusers = spWeb.AllUsers;
        List<SPUser> users = allusers.Cast<SPUser>().ToList();
        var query = from spUser in users.Select(usr => new {id = usr.ID, name = usr.Name})
                        .Where(p => p.name.IndexOf(filter, StringComparison.InvariantCultureIgnoreCase) >= 0)
                    select new {id = spUser.id.ToString(), spUser.name};

        return new JavaScriptSerializer().Serialize(query);
    }

How can I query active directory like this? Is it possible to retrieve all AD connection settings from sharepoint itself? I need just id and user name to fill my dropdownlist Converting this to SPUserCollection is another big deal.

It would be great to use some built-in SP methods like this:

[SubsetCallableExcludeMember(SubsetCallableExcludeMemberType.UnsupportedSPType)]
 public static SPPrincipalInfo ResolveWindowsPrincipal(SPWebApplication webApp,      string input, SPPrincipalType scopes, bool inputIsEmailOnly)
 {
    return ResolveWindowsPrincipal(null, webApp, input, scopes, inputIsEmailOnly);
 }





    

I have to populate my autocomplete PeopleEditor-like control based on brililant ASPTokenInput with all people from my AD domain. Reflecting PeopleEditor shows a real mess in their Active Directory search engine and all potentially helpful classes are internal.

My test method works fine, but I need to get ALL users from AD(not sharepoint site ones) to populate my list: How it looks

public string GetUsers(string filter)
    {
        var spWeb = SPContext.Current.Web;
        SPUserCollection allusers = spWeb.AllUsers;
        List<SPUser> users = allusers.Cast<SPUser>().ToList();
        var query = from spUser in users.Select(usr => new {id = usr.ID, name = usr.Name})
                        .Where(p => p.name.IndexOf(filter, StringComparison.InvariantCultureIgnoreCase) >= 0)
                    select new {id = spUser.id.ToString(), spUser.name};

        return new JavaScriptSerializer().Serialize(query);
    }

How can I query active directory like this? Is it possible to retrieve all AD connection settings from sharepoint itself? I need just id and user name to fill my dropdownlist Converting this to SPUserCollection is another big deal.

I have to populate my autocomplete PeopleEditor-like control based on brililant ASPTokenInput with all people from my AD domain. Reflecting PeopleEditor shows a real mess in their Active Directory search engine and all potentially helpful classes are internal.

My test method works fine, but I need to get ALL users from AD(not sharepoint site ones) to populate my list: How it looks

public string GetUsers(string filter)
    {
        var spWeb = SPContext.Current.Web;
        SPUserCollection allusers = spWeb.AllUsers;
        List<SPUser> users = allusers.Cast<SPUser>().ToList();
        var query = from spUser in users.Select(usr => new {id = usr.ID, name = usr.Name})
                        .Where(p => p.name.IndexOf(filter, StringComparison.InvariantCultureIgnoreCase) >= 0)
                    select new {id = spUser.id.ToString(), spUser.name};

        return new JavaScriptSerializer().Serialize(query);
    }

How can I query active directory like this? Is it possible to retrieve all AD connection settings from sharepoint itself? I need just id and user name to fill my dropdownlist Converting this to SPUserCollection is another big deal.

It would be great to use some built-in SP methods like this:

[SubsetCallableExcludeMember(SubsetCallableExcludeMemberType.UnsupportedSPType)]
 public static SPPrincipalInfo ResolveWindowsPrincipal(SPWebApplication webApp,      string input, SPPrincipalType scopes, bool inputIsEmailOnly)
 {
    return ResolveWindowsPrincipal(null, webApp, input, scopes, inputIsEmailOnly);
 }





    
Source Link
Bassist
  • 41
  • 1
  • 7

Get all users from active directory to sharepoint

I have to populate my autocomplete PeopleEditor-like control based on brililant ASPTokenInput with all people from my AD domain. Reflecting PeopleEditor shows a real mess in their Active Directory search engine and all potentially helpful classes are internal.

My test method works fine, but I need to get ALL users from AD(not sharepoint site ones) to populate my list: How it looks

public string GetUsers(string filter)
    {
        var spWeb = SPContext.Current.Web;
        SPUserCollection allusers = spWeb.AllUsers;
        List<SPUser> users = allusers.Cast<SPUser>().ToList();
        var query = from spUser in users.Select(usr => new {id = usr.ID, name = usr.Name})
                        .Where(p => p.name.IndexOf(filter, StringComparison.InvariantCultureIgnoreCase) >= 0)
                    select new {id = spUser.id.ToString(), spUser.name};

        return new JavaScriptSerializer().Serialize(query);
    }

How can I query active directory like this? Is it possible to retrieve all AD connection settings from sharepoint itself? I need just id and user name to fill my dropdownlist Converting this to SPUserCollection is another big deal.