diff --git a/packages/mgt-components/src/components/mgt-person-card/mgt-person-card.graph.ts b/packages/mgt-components/src/components/mgt-person-card/mgt-person-card.graph.ts index b1e846b1a3..fa1ab7c99d 100644 --- a/packages/mgt-components/src/components/mgt-person-card/mgt-person-card.graph.ts +++ b/packages/mgt-components/src/components/mgt-person-card/mgt-person-card.graph.ts @@ -6,7 +6,7 @@ */ import { BatchResponse, CacheItem, CacheService, CacheStore, IBatch, IGraph, prepScopes } from '@microsoft/mgt-element'; -import { Chat, ChatMessage } from '@microsoft/microsoft-graph-types'; +import { Chat, ChatMessage, Person } from '@microsoft/microsoft-graph-types'; import { Profile } from '@microsoft/microsoft-graph-types-beta'; import { getEmailFromGraphEntity } from '../../graph/graph.people'; @@ -48,7 +48,7 @@ export const getPersonCardGraphData = async ( personDetails: IDynamicPerson, isMe: boolean ): Promise => { - const userId = personDetails.id; + const userId: string = personDetails.id || (personDetails as Person).userPrincipalName; const email = getEmailFromGraphEntity(personDetails); const cache: CacheStore = CacheService.getCache( schemas.users, diff --git a/packages/mgt-components/src/components/mgt-person-card/mgt-person-card.ts b/packages/mgt-components/src/components/mgt-person-card/mgt-person-card.ts index bb3e03b655..c7808d206b 100644 --- a/packages/mgt-components/src/components/mgt-person-card/mgt-person-card.ts +++ b/packages/mgt-components/src/components/mgt-person-card/mgt-person-card.ts @@ -649,7 +649,7 @@ export class MgtPersonCard extends MgtTemplatedTaskComponent implements IHistory // Chat let chat: TemplateResult; - if (userPerson?.userPrincipalName) { + if (userPerson?.userPrincipalName || userPerson?.mail) { ariaLabel = `${this.strings.chatButtonLabel} ${person.displayName}`; chat = html` { - const user = this.personDetails as User; - const person = this.personDetails as microsoftgraph.Person; + const user = this.internalPersonDetails as User; + const person = this.internalPersonDetails as Person; if (user?.businessPhones?.length) { const phone = user.businessPhones[0]; @@ -1163,8 +1162,8 @@ export class MgtPersonCard extends MgtTemplatedTaskComponent implements IHistory */ protected videoCallUser = () => { const user = this.personDetails as User; - if (user?.userPrincipalName) { - const users: string = user.userPrincipalName; + if (user?.userPrincipalName || user?.mail) { + const users: string = user.userPrincipalName || user.mail; const url = `https://teams.microsoft.com/l/call/0/0?users=${users}&withVideo=true`; @@ -1258,7 +1257,7 @@ export class MgtPersonCard extends MgtTemplatedTaskComponent implements IHistory return this.personImage; } - const person = this.personDetails; + const person = this.internalPersonDetails; return person?.personImage ? person.personImage : null; }