Exemple #1
0
        private IEnumerable <IMailFolder> GetSubFolders()
        {
            string uri = _folder == null ? "Folders" : Uri + "/ChildFolders";

            var folders = HttpUtilSync.GetItems <Folder>(uri, int.MaxValue);

            return(folders.Select(f => new MailFolderProviderHTTP(f)));
        }
        // Create a reply message
        public IMailItem Reply(bool replyAll)
        {
            string uri = Uri + (replyAll ? "/CreateReplyAll" : "/CreateReply");

            Message replyMsg = HttpUtilSync.PostItem <Message>(Uri + "/CreateReply");

            return(new MailItemProviderHTTP(replyMsg));
        }
Exemple #3
0
        public MailStoreProviderHTTP(string userName, string password)
        {
            AuthenticationHelperHTTP.Initialize(userName, password);

            var user = HttpUtilSync.GetItem <User>(string.Empty);

            DisplayName = user.Id;
            RootFolder  = new MailFolderProviderHTTP(null, DisplayName);
        }
Exemple #4
0
        public IMailFolder AddSubFolder(string name)
        {
            dynamic folderName = new ExpandoObject();

            folderName.DisplayName = name;

            Folder newFolder = HttpUtilSync.PostItemDynamic <Folder>(Uri + "/ChildFolders", folderName);

            return(new MailFolderProviderHTTP(newFolder));
        }
Exemple #5
0
 private int GetChildFolderCount()
 {
     if (_folder == null)
     {
         return(HttpUtilSync.GetItem <int>("Folders/$count"));
     }
     else
     {
         return(HttpUtilSync.GetItem <int>(Uri + "/ChildFolders/$count"));
     }
 }
        public void Move(IMailFolder newFolder)
        {
            var folderProvider = newFolder as MailFolderProviderHTTP;

            var folderId = folderProvider.Handle;

            dynamic destination = new ExpandoObject();

            destination.DestinationId = folderId;

            HttpUtilSync.PostItemDynamic <Message>(Uri + "/Move", destination);
        }
        private IEnumerable <string> EnumerateUsersHttp(string match, int count)
        {
            string uri = "https://graph/windows.net/" + AuthenticationHelper.TenantId;

            uri += "/users()";

            uri = AddFilters(uri, match, "userPrincipalName", "displayName", "givenName", "surName");

            var users = HttpUtilSync.GetItems <IEnumerable <UserHttp> >(uri);

            return(users.Select(x => x.UserPrincipalName));
        }
        public IEnumerable <string> GetUsers(string match, int count)
        {
#if MEETING_TIMES
            MeetingTimes times = new MeetingTimes();

            MeetingTimeSlot timeSlot = new MeetingTimeSlot();
            timeSlot.Start = new TimeDesc("2015-10-08", "1:00:00", "GMT Standard Time");
            timeSlot.End   = new TimeDesc("2015-10-08", "23:00:00", "GMT Standard Time");

            AttendeeBase att1 = new AttendeeBase();
//            att1.EmailAddress.Address = "*****@*****.**";
            att1.EmailAddress.Address = "*****@*****.**";

            AttendeeBase att2 = new AttendeeBase();
            att2.EmailAddress.Address = "*****@*****.**";

            times.TimeConstraint.Timeslots.Add(timeSlot);
            times.LocationConstraint = new LocationConstraint();

            times.Attendees.Add(att1);
//            times.Attendees.Add(att2);

            var    httpProxy = new HttpUtilSync(Constants.OfficeResourceId);
            String uri       = "https://outlook.office365.com/api/beta/me/findmeetingtimes";

            var res = httpProxy.PostItem2 <MeetingTimes, MeetingTimeCandidates>(uri, times);

            return(null);
#else
            string uri = BaseUri + "users";
            uri += '?';     // we always have at least api version parameter

            if (string.IsNullOrEmpty(match) == false)
            {
                uri = AddFilters(uri, match,
                                 "userPrincipalName",
                                 "displayName",
                                 "givenName" /*, "surName"*/);

                uri += '&';
            }

            uri += ApiVersion;

            var users = new HttpUtilSync(Constants.AadServiceResourceId)
                        .GetItems <UserHttp>(uri, count);

            return(users.Select(x => x.UserPrincipalName));
#endif
        }
        public void AddAttachment(string filepath)
        {
            using (var reader = new StreamReader(filepath))
            {
                var contents = reader.ReadToEnd();

                var bytes = System.Text.Encoding.UTF8.GetBytes(contents);
                var name  = filepath.Split('\\').Last();

                var fileAttachment = new FileAttachment
                {
                    ContentBytes = bytes,
                    Name         = name,
                };

                HttpUtilSync.PostItem(Uri + "/attachments", fileAttachment);
            }
        }
Exemple #10
0
        public IEnumerable <string> GetUsers(string match, int count)
        {
            string uri = BaseUri + "users";

            uri += '?';     // we always have at least api version parameter

            if (string.IsNullOrEmpty(match) == false)
            {
                uri = AddFilters(uri, match,
                                 "userPrincipalName",
                                 "displayName",
                                 "givenName" /*, "surName"*/);

                uri += '&';
            }

            uri += ApiVersion;

            var users = new HttpUtilSync(Constants.AadServiceResourceId)
                        .GetItems <UserHttp>(uri, count);

            return(users.Select(x => x.UserPrincipalName));
        }
Exemple #11
0
        public IEnumerable <string> GetDLMembers(string dLName, int count)
        {
            if (string.IsNullOrEmpty(dLName))
            {
                return(Enumerable.Empty <string>());
            }

            string uri = BaseUri + "groups";

            uri += '?';     // we always have at least api version parameter

            uri = AddFilters(uri, dLName,
                             "displayName"
                             );

            uri += '&';
            uri += ApiVersion;

            var httpProxy = new HttpUtilSync(Constants.AadServiceResourceId);

            var groups = httpProxy.GetItems <GroupHttp>(uri, 100);

            // Look for the group with exact name match
            var group = groups.FirstOrDefault((g) => g.DisplayName.EqualsCaseInsensitive(dLName));

            if (group == null)
            {
                return(Enumerable.Empty <string>());
            }

            uri = BaseUri + "groups/" + group.ObjectId + "/members?" + ApiVersion;

            var members = httpProxy.GetItems <UserHttp>(uri, count);

            return(members.Select(x => x.UserPrincipalName));
        }
 public void Delete()
 {
     HttpUtilSync.DeleteItem(Uri);
     _message = null;
 }
 public void Send()
 {
     HttpUtilSync.PatchItem(Uri, _message);
     HttpUtilSync.PostItem <Message>(Uri + "/Send");
 }
        public IMailItem Forward()
        {
            Message msg = HttpUtilSync.PostItem <Message>(Uri + "/CreateForward");

            return(new MailItemProviderHTTP(msg));
        }
Exemple #15
0
 public void Delete()
 {
     HttpUtilSync.DeleteItem(Uri);
 }
Exemple #16
0
 private int GetMailCount()
 {
     return(HttpUtilSync.GetItem <int>(Uri + "/Messages/$count"));
 }
Exemple #17
0
        private IEnumerable <MailItemProviderHTTP.Message> GetMessages(int count)
        {
            string uri = Uri + string.Format("/Messages?&$top={0}", PageSize);

            return(HttpUtilSync.GetItems <MailItemProviderHTTP.Message>(uri, count));
        }