UNPKG

mui-spfx-controls

Version:
34 lines 1.38 kB
import { User } from '@microsoft/microsoft-graph-types'; import { WebPartContext } from '@microsoft/sp-webpart-base'; /** * Service class for User profiles */ declare class UserService { private readonly graph; /** * Initializes the ProfileService instance. * @param {WebPartContext} context - The SharePoint WebPart context. */ constructor(context: WebPartContext); /** * Fetches current user details from Microsoft Graph. * @returns {Promise<User>} A promise resolving to current user profile details. * @throws {Error} - Throws an error if the request fails due to insufficient permissions. * @example * const user = await profileService.getUser('john.doe@example.com'); * console.log(user.displayName, user.mail); */ getCurrentUser(): Promise<User>; /** * Fetches user details from Microsoft Graph using either a user ID or email. * @param upn - The user's upn * @returns {Promise<User>} A promise resolving to the user profile details. * @throws {Error} - Throws an error if the request fails due to insufficient permissions. * @example * const user = await profileService.getUser('john.doe@example.com'); * console.log(user.displayName, user.mail); */ getUser(upn: string): Promise<User>; } export { UserService }; //# sourceMappingURL=UserService.d.ts.map