예제 #1
0
        /// <summary>
        /// Check if a mail thread is ignored or not
        /// If it is ignored then there is nothing for us to do with it.
        /// Normally another rule kicks in and deletes it.
        /// </summary>
        /// <param name="mailItem"></param>
        /// <returns></returns>
        private bool IsIgnoredConversation(Outlook._MailItem mailItem)
        {
            // does the folder allow conversations?
            var folder = mailItem.Parent as Outlook.MAPIFolder;
            var store  = folder?.Store;

            if (store?.IsConversationEnabled != true)
            {
                return(false);
            }

            // get that conversation
            Outlook._Conversation conv = mailItem.GetConversation();

            // get the delete rule.
            var delete = conv?.GetAlwaysDelete(_session.DefaultStore) ?? Outlook.OlAlwaysDeleteConversation.olDoNotDelete;

            // if we want to delete the conversation, then we can assume it is ignored.
            return(Outlook.OlAlwaysDeleteConversation.olAlwaysDelete == delete);
        }