public virtual DeleteMapiMailDefinition MakeDeleteMapiMailDefinition(string senderEmailAddress, string internetMessageId)
 {
     if (string.IsNullOrEmpty(senderEmailAddress))
     {
         throw new ArgumentException("senderEmailAddress is null or empty");
     }
     return(DeleteMapiMailDefinition.CreateInstance("IPM.Note.MapiSubmitSystemProbe", senderEmailAddress, internetMessageId));
 }
예제 #2
0
        private DeletionResult DeleteMessageFromOutboxHelper(DeleteMapiMailDefinition deleteMapiMailDefinition)
        {
            DeletionResult    result = DeletionResult.Fail;
            string            domainPartOfEmailAddress = MapiMessageSubmitter.GetDomainPartOfEmailAddress(deleteMapiMailDefinition.SenderEmailAddress);
            ExchangePrincipal mailboxOwner             = ExchangePrincipal.FromProxyAddress(ADSessionSettings.RootOrgOrSingleTenantFromAcceptedDomainAutoDetect(domainPartOfEmailAddress), deleteMapiMailDefinition.SenderEmailAddress);
            QueryFilter       queryFilter = new AndFilter(new List <QueryFilter>(2)
            {
                new TextFilter(ItemSchema.InternetMessageId, deleteMapiMailDefinition.InternetMessageId, MatchOptions.FullString, MatchFlags.IgnoreCase),
                new TextFilter(StoreObjectSchema.ItemClass, deleteMapiMailDefinition.MessageClass, MatchOptions.FullString, MatchFlags.IgnoreCase)
            }.ToArray());

            using (MailboxSession mailboxSession = MailboxSession.OpenAsTransport(mailboxOwner, "Client=Monitoring;Action=MapiSubmitLAMProbe"))
            {
                using (Folder folder = Folder.Bind(mailboxSession, DefaultFolderType.Outbox))
                {
                    using (QueryResult queryResult = folder.ItemQuery(ItemQueryType.None, queryFilter, null, new PropertyDefinition[]
                    {
                        ItemSchema.Id
                    }))
                    {
                        object[][] rows = queryResult.GetRows(1);
                        if (rows == null || rows.Length == 0)
                        {
                            result = DeletionResult.NoMatchingMessage;
                        }
                        else
                        {
                            mailboxSession.Delete(DeleteItemFlags.HardDelete, new StoreId[]
                            {
                                ((VersionedId)rows[0][0]).ObjectId
                            });
                            result = DeletionResult.Success;
                        }
                    }
                }
            }
            return(result);
        }
예제 #3
0
        public DeletionResult DeleteMessageFromOutbox(string senderEmailAddress, string internetMessageId)
        {
            DeleteMapiMailDefinition deleteMapiMailDefinition = this.MonitoringFactory.MakeDeleteMapiMailDefinition(senderEmailAddress, internetMessageId);

            return(this.MapiMessageSubmitter.DeleteMessageFromOutbox(deleteMapiMailDefinition));
        }
예제 #4
0
 public DeletionResult DeleteMessageFromOutbox(DeleteMapiMailDefinition deleteMapiMailDefinition)
 {
     return(this.DeleteMessageFromOutboxHelper(deleteMapiMailDefinition));
 }