Example #1
0
        /// <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");
            }
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PersonModel"/> class from Google person.
        /// </summary>
        /// <param name="gmailPerson">Google person.</param>
        public PersonModel(Google.Apis.People.v1.Data.Person gmailPerson)
        {
            source                 = MailSource.Google;
            this.Id                = gmailPerson?.EmailAddresses?[0]?.Value;
            this.DisplayName       = gmailPerson?.Names?[0]?.DisplayName;
            this.UserPrincipalName = gmailPerson?.Names?[0]?.DisplayNameLastFirst;

            this.Emails = new List <string>();
            if (gmailPerson?.EmailAddresses != null)
            {
                foreach (var email in gmailPerson.EmailAddresses)
                {
                    this.Emails.Add(email.Value);
                }
            }

            this.Photo = gmailPerson?.Photos?[0]?.Url;
        }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PersonModel"/> class from Google person.
 /// </summary>
 /// <param name="gmailPerson">Google person.</param>
 public PersonModel(Google.Apis.People.v1.Data.Person gmailPerson)
 {
     source          = EventSource.Google;
     gmailPersonData = gmailPerson;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PersonModel"/> class from Google person.
 /// </summary>
 /// <param name="gmailPerson">Google person.</param>
 public PersonModel(Google.Apis.People.v1.Data.Person gmailPerson)
 {
     source          = EventSource.Google;
     gmailPersonData = gmailPerson;
     this.Photo      = gmailPerson?.Photos?[0]?.Url;
 }