/// <summary> /// Initializes a new instance of the <see cref="PersonModel"/> class from MS Graph person. /// </summary> /// <param name="msftPerson">MS Graph person.</param> public PersonModel(Microsoft.Graph.Person msftPerson) { source = MailSource.Microsoft; this.Id = msftPerson.Id; this.DisplayName = msftPerson?.DisplayName; this.UserPrincipalName = msftPerson?.UserPrincipalName; this.Emails = new List <string>(); if (msftPerson?.ScoredEmailAddresses != null) { foreach (var email in msftPerson.ScoredEmailAddresses) { this.Emails.Add(email.Address); } } }
/// <summary> /// Initializes a new instance of the <see cref="PersonModel"/> class. /// </summary> /// <param name="source">the event source.</param> public PersonModel(EventSource source) { this.source = source; switch (this.source) { case EventSource.Microsoft: msftPersonData = new Microsoft.Graph.Person(); break; case EventSource.Google: gmailPersonData = new Google.Apis.People.v1.Data.Person(); break; default: throw new Exception("Event Type not Defined"); } }
/// <summary> /// Initializes a new instance of the <see cref="PersonModel"/> class from MS Graph person. /// </summary> /// <param name="msftPerson">MS Graph person.</param> public PersonModel(Microsoft.Graph.Person msftPerson) { source = EventSource.Microsoft; msftPersonData = msftPerson; }