public void MarkUnread(ChannelMessageHeader message)
        {
            var client    = new ExchangeClient(Hostname, CredentialsProvider);
            var messageId = client.GetMessageId(message.MessageNumber).ItemId;

            client.SetMessageReadState(messageId, false);
        }
        public void AddLabel(ChannelMessageHeader message, string labelname)
        {
            var client    = new ExchangeClient(Hostname, CredentialsProvider);
            var messageId = client.GetMessageId(message.MessageNumber).ItemId;

            client.CopyMessageToFolder(messageId, folders.First(f => f.Name.ToLower() == labelname.ToLower()).FolderId);
        }
        public void RemoveLabel(string messagenumber, string labelname)
        {
            var client    = new ExchangeClient(Hostname, CredentialsProvider);
            var messageId = client.GetMessageId(messagenumber).ItemId;

            client.DeleteMessage(messageId);
        }
        public void CopyToFolder(ChannelMessageHeader message, ChannelFolder folder)
        {
            var client    = new ExchangeClient(Hostname, CredentialsProvider);
            var messageId = client.GetMessageId(message.MessageNumber).ItemId;

            client.CopyMessageToFolder(messageId, folder.FolderId);
        }
        public void RemoveFromFolder(ChannelMessageHeader message, ChannelFolder folder)
        {
            var client    = new ExchangeClient(Hostname, CredentialsProvider);
            var messageId = client.GetMessageId(message.MessageNumber).ItemId;

            client.DeleteMessage(messageId);
        }
        public void Purge(ChannelMessageHeader message)
        {
            var client    = new ExchangeClient(Hostname, CredentialsProvider);
            var messageId = client.GetMessageId(message.MessageNumber).ItemId;

            client.DeleteMessage(messageId);
        }
        public void SetStarred(ChannelMessageHeader message, bool starred)
        {
            var client    = new ExchangeClient(Hostname, CredentialsProvider);
            var messageId = client.GetMessageId(message.MessageNumber).ItemId;

            client.SetMessageImportance(messageId, starred);
        }
        public void MarkDeleted(ChannelMessageHeader message)
        {
            var trash = GetFolders().First(f => f.FolderType == ChannelFolderType.Trash);

            var client    = new ExchangeClient(Hostname, CredentialsProvider);
            var messageId = client.GetMessageId(message.MessageNumber).ItemId;

            client.MoveMessageToFolder(messageId, trash.FolderId);
        }
        public void Send(ChannelMessage message)
        {
            var client = new ExchangeClient(Hostname, CredentialsProvider);

            var messageId = client.SaveMessage(message);

            // Upload attachments
            if (message.Attachments.Count > 0)
            {
                client.SaveAttachments(messageId, message);
            }

            // Refresh and send message by message-id
            client.SendMessage(client.GetMessageId(messageId.Id).ItemId);
        }
        public void RemoveLabel(string messagenumber, string labelname)
        {
            var client = new ExchangeClient(Hostname, CredentialsProvider);
            var messageId = client.GetMessageId(messagenumber).ItemId;

            client.DeleteMessage(messageId);
        }
        public void RemoveFromFolder(ChannelMessageHeader message, ChannelFolder folder)
        {
            var client = new ExchangeClient(Hostname, CredentialsProvider);
            var messageId = client.GetMessageId(message.MessageNumber).ItemId;

            client.DeleteMessage(messageId);
        }
        public void Purge(ChannelMessageHeader message)
        {
            var client = new ExchangeClient(Hostname, CredentialsProvider);
            var messageId = client.GetMessageId(message.MessageNumber).ItemId;

            client.DeleteMessage(messageId);
        }
        public void MoveToFolder(ChannelMessageHeader message, ChannelFolder folder)
        {
            var client = new ExchangeClient(Hostname, CredentialsProvider);
            var messageId = client.GetMessageId(message.MessageNumber).ItemId;

            client.MoveMessageToFolder(messageId, folder.FolderId);
        }
        public void MarkUnread(ChannelMessageHeader message)
        {
            var client = new ExchangeClient(Hostname, CredentialsProvider);
            var messageId = client.GetMessageId(message.MessageNumber).ItemId;

            client.SetMessageReadState(messageId, false);
        }
        public void MarkDeleted(ChannelMessageHeader message)
        {
            var trash = GetFolders().First(f => f.FolderType == ChannelFolderType.Trash);

            var client = new ExchangeClient(Hostname, CredentialsProvider);
            var messageId = client.GetMessageId(message.MessageNumber).ItemId;

            client.MoveMessageToFolder(messageId, trash.FolderId);
        }
        public void Send(ChannelMessage message)
        {
            var client = new ExchangeClient(Hostname, CredentialsProvider);

            var messageId = client.SaveMessage(message);

            // Upload attachments
            if (message.Attachments.Count > 0)
                client.SaveAttachments(messageId, message);

            // Refresh and send message by message-id
            client.SendMessage(client.GetMessageId(messageId.Id).ItemId);
        }
        public void SetStarred(ChannelMessageHeader message, bool starred)
        {
            var client = new ExchangeClient(Hostname, CredentialsProvider);
            var messageId = client.GetMessageId(message.MessageNumber).ItemId;

            client.SetMessageImportance(messageId, starred);
        }
        public void AddLabel(ChannelMessageHeader message, string labelname)
        {
            var client = new ExchangeClient(Hostname, CredentialsProvider);
            var messageId = client.GetMessageId(message.MessageNumber).ItemId;

            client.CopyMessageToFolder(messageId, folders.First(f => f.Name.ToLower() == labelname.ToLower()).FolderId);
        }