UNPKG

@microsoft/teams-js

Version:

Microsoft Client SDK for building app for Microsoft hosts

74 lines (71 loc) 3.46 kB
import { SdkError } from './interfaces'; /** Select people callback function type */ export type selectPeopleCallbackFunctionType = (error: SdkError, people: PeoplePickerResult[]) => void; /** * Launches a people picker and allows the user to select one or more people from the list * If the app is added to personal app scope the people picker launched is org wide and if the app is added to a chat/channel, people picker launched is also limited to the members of chat/channel * @param callback - Returns list of JSON object of type PeoplePickerResult which consists of Microsoft Entra IDs, display names and emails of the selected users * @param peoplePickerInputs - Input parameters to launch customized people picker * @returns Promise that will be fulfilled when the operation has completed */ export declare function selectPeople(peoplePickerInputs?: PeoplePickerInputs): Promise<PeoplePickerResult[]>; /** * @deprecated * As of TeamsJS v2.0.0, please use {@link people.selectPeople people.selectPeople(peoplePickerInputs?: PeoplePickerInputs): Promise\<PeoplePickerResult[]\>} instead. * * Launches a people picker and allows the user to select one or more people from the list * If the app is added to personal app scope the people picker launched is org wide and if the app is added to a chat/channel, people picker launched is also limited to the members of chat/channel * @param callback - Returns list of JSON object of type PeoplePickerResult which consists of Microsoft Entra IDs, display names and emails of the selected users * @param peoplePickerInputs - Input parameters to launch customized people picker */ export declare function selectPeople(callback: selectPeopleCallbackFunctionType, peoplePickerInputs?: PeoplePickerInputs): void; /** * Input parameter supplied to the People Picker API */ export interface PeoplePickerInputs { /** * Optional; Set title for the people picker * Default value is "Select people" for multiselect and "Select a person" for single select */ title?: string; /** * Optional; Microsoft Entra IDs of the users to be pre-populated in the search box of people picker control * If single select is enabled this value, only the first user in the list will be pre-populated * Default value is null */ setSelected?: string[]; /** * Optional; launches the people picker in org wide scope even if the app is added to a chat or channel * Default value is false */ openOrgWideSearchInChatOrChannel?: boolean; /** * Optional; launches the people picker for which only 1 person can be selected * Default value is false */ singleSelect?: boolean; } /** * Output user object of people picker API */ export interface PeoplePickerResult { /** * user object ID (also known as Microsoft Entra ID) of the selected user */ objectId: string; /** * Optional; display name of the selected user */ displayName?: string; /** * Optional; email of the selected user */ email?: string; } /** * Checks if the people capability is supported by the host * @returns boolean to represent whether the people capability is supported * * @throws Error if {@linkcode app.initialize} has not successfully completed */ export declare function isSupported(): boolean;