Ejemplo n.º 1
0
        public IMailService InitMailService(string token, TimeZoneInfo timeZoneInfo, MailSource source)
        {
            var mockGraphServiceClient        = new MockGraphServiceClient();
            IGraphServiceClient serviceClient = mockGraphServiceClient.GetMockGraphServiceClient().Object;
            MSGraphMailAPI      mailService   = new MSGraphMailAPI(serviceClient, timeZoneInfo: TimeZoneInfo.Local);

            return(mailService);
        }
Ejemplo n.º 2
0
        public IUserService InitUserService(string token, TimeZoneInfo timeZoneInfo, MailSource source)
        {
            var mockGraphServiceClient        = new MockGraphServiceClientGen();
            IGraphServiceClient serviceClient = mockGraphServiceClient.GetMockGraphServiceClient().Object;
            MSGraphUserService  userService   = new MSGraphUserService(serviceClient, timeZoneInfo: TimeZoneInfo.Local);

            return(userService);
        }
Ejemplo n.º 3
0
        /// <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);
                }
            }
        }
        /// <inheritdoc/>
        public IMailService InitMailService(string token, TimeZoneInfo timeZoneInfo, MailSource source)
        {
            switch (source)
            {
            case MailSource.Microsoft:
                var serviceClient = GraphClient.GetAuthenticatedClient(token, timeZoneInfo);
                return(new MSGraphMailAPI(serviceClient, timeZoneInfo));

            case MailSource.Google:
                var googleClient        = GoogleClient.GetGoogleClient(_settings);
                var googleServiceClient = GMailService.GetServiceClient(googleClient, token);
                return(new GMailService(googleServiceClient));

            default:
                throw new Exception("Event Type not Defined");
            }
        }
Ejemplo n.º 5
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;
        }
Ejemplo n.º 6
0
        public static string GetSourceType(MailSource mailSource)
        {
            var result = mailSource.ToString();

            switch (mailSource)
            {
            case MailSource.Microsoft:
                result = "Microsoft Graph";
                break;

            case MailSource.Google:
                result = "Google";
                break;

            default:
                throw new Exception("Source Type not Defined.");
            }

            return(result);
        }
Ejemplo n.º 7
0
 public void Clear()
 {
     NameList.Clear();
     Message.Clear();
     Content = null;
     Subject = null;
     Recipients.Clear();
     ConfirmRecipientIndex     = 0;
     ShowEmailIndex            = 0;
     IsUnreadOnly              = true;
     IsImportant               = false;
     StartDateTime             = DateTime.UtcNow.Add(new TimeSpan(-7, 0, 0, 0));
     EndDateTime               = DateTime.UtcNow;
     DirectlyToMe              = false;
     SenderName                = null;
     EmailList                 = new List <string>();
     ShowRecipientIndex        = 0;
     LuisResultPassedFromSkill = null;
     MailSourceType            = MailSource.Other;
 }
Ejemplo n.º 8
0
 public IUserService InitUserService(string token, TimeZoneInfo timeZoneInfo, MailSource mailSource)
 {
     return(UserService);
 }
Ejemplo n.º 9
0
 public IMailService InitMailService(string token, TimeZoneInfo timeZoneInfo, MailSource mailSource)
 {
     return(MailService);
 }