useSearchUser

useSearchUser(
	searchOptions: string | IClientPeoplePickerQueryParameters,
	options?: SearchUserOptions,
	deps?: any[]): IPeoplePickerEntity[] | null | undefined;

Searches for users or groups with specified search options.

Examples

Search user by text,

// basic usage
const searchResults = useSearchUser("Mark");

Search user by custom query object,

const query = {
    AllowEmailAddresses: true,
    AllowMultipleEntities: true,
    MaximumEntitySuggestions: 25,
    PrincipalType: PrincipalType.All,
    QueryString: "query text"
};

const searchResults = useSearchUser(query, undefined, [query?.QueryString]);

Parameters

NameTypeDescriptionTracked for changes
searchOptionsstring | IClientPeoplePickerQueryParametersSearch text or query objectYes for string, No for query object
options?SearchUserOptionsuseSearchUser hook optionsPartially
deps?DependencyListHook dependency list.Yes