@@ -649,7 +649,7 @@ export class MgtPersonCard extends MgtTemplatedTaskComponent implements IHistory
649649
650650 // Chat
651651 let chat : TemplateResult ;
652- if ( userPerson ?. userPrincipalName ) {
652+ if ( userPerson ?. userPrincipalName || userPerson ?. mail ) {
653653 ariaLabel = `${ this . strings . chatButtonLabel } ${ person . displayName } ` ;
654654 chat = html `
655655 < fluent-button class ="icon "
@@ -662,7 +662,7 @@ export class MgtPersonCard extends MgtTemplatedTaskComponent implements IHistory
662662
663663 // Video
664664 let video : TemplateResult ;
665- if ( userPerson ?. userPrincipalName ) {
665+ if ( userPerson ?. userPrincipalName || userPerson ?. mail ) {
666666 ariaLabel = `${ this . strings . videoButtonLabel } ${ person . displayName } ` ;
667667 video = html `
668668 < fluent-button class ="icon "
@@ -990,15 +990,12 @@ export class MgtPersonCard extends MgtTemplatedTaskComponent implements IHistory
990990 // check if personDetail already populated
991991 if ( this . personDetails ) {
992992 const user = this . personDetails ;
993- let id : string ;
994- if ( isUser ( user ) ) {
995- id = user . userPrincipalName || user . id ;
996- }
993+ const userId = ( user as Person ) . userPrincipalName || user . id ;
997994
998995 // if we have an id but no email, we should get data from the graph
999996 // in some graph calls, the user object does not contain the email
1000- if ( id && ! getEmailFromGraphEntity ( user ) ) {
1001- const person = await getUserWithPhoto ( graph , id ) ;
997+ if ( userId && ! getEmailFromGraphEntity ( user ) ) {
998+ const person = await getUserWithPhoto ( graph , userId ) ;
1002999 this . personDetails = person ;
10031000 this . personImage = this . getImage ( ) ;
10041001 }
@@ -1041,9 +1038,11 @@ export class MgtPersonCard extends MgtTemplatedTaskComponent implements IHistory
10411038 }
10421039 }
10431040
1041+ const personId = this . personDetails ?. id || ( this . personDetails as Person ) ?. userPrincipalName ;
1042+
10441043 // populate state
1045- if ( this . personDetails ?. id ) {
1046- this . _cardState = await getPersonCardGraphData ( graph , this . personDetails , this . _me === this . personDetails . id ) ;
1044+ if ( personId ) {
1045+ this . _cardState = await getPersonCardGraphData ( graph , this . personDetails , this . _me === personId ) ;
10471046 }
10481047
10491048 this . loadSections ( ) ;
@@ -1096,8 +1095,8 @@ export class MgtPersonCard extends MgtTemplatedTaskComponent implements IHistory
10961095 } ;
10971096
10981097 private get hasPhone ( ) : boolean {
1099- const user = this . personDetails as User ;
1100- const person = this . personDetails as microsoftgraph . Person ;
1098+ const user = this . internalPersonDetails as User ;
1099+ const person = this . internalPersonDetails as Person ;
11011100 return Boolean ( user ?. businessPhones ?. length ) || Boolean ( person ?. phones ?. length ) ;
11021101 }
11031102
@@ -1108,8 +1107,8 @@ export class MgtPersonCard extends MgtTemplatedTaskComponent implements IHistory
11081107 * @memberof MgtPersonCard
11091108 */
11101109 protected callUser = ( ) => {
1111- const user = this . personDetails as User ;
1112- const person = this . personDetails as microsoftgraph . Person ;
1110+ const user = this . internalPersonDetails as User ;
1111+ const person = this . internalPersonDetails as Person ;
11131112
11141113 if ( user ?. businessPhones ?. length ) {
11151114 const phone = user . businessPhones [ 0 ] ;
@@ -1163,8 +1162,8 @@ export class MgtPersonCard extends MgtTemplatedTaskComponent implements IHistory
11631162 */
11641163 protected videoCallUser = ( ) => {
11651164 const user = this . personDetails as User ;
1166- if ( user ?. userPrincipalName ) {
1167- const users : string = user . userPrincipalName ;
1165+ if ( user ?. userPrincipalName || user ?. mail ) {
1166+ const users : string = user . userPrincipalName || user . mail ;
11681167
11691168 const url = `https://teams.microsoft.com/l/call/0/0?users=${ users } &withVideo=true` ;
11701169
@@ -1258,7 +1257,7 @@ export class MgtPersonCard extends MgtTemplatedTaskComponent implements IHistory
12581257 return this . personImage ;
12591258 }
12601259
1261- const person = this . personDetails ;
1260+ const person = this . internalPersonDetails ;
12621261 return person ?. personImage ? person . personImage : null ;
12631262 }
12641263
0 commit comments