Esempio n. 1
0
        public static bool DeleteMessage(string storeId, string entryId, bool DeletedItems)
        {
            if (!DeletedItems)
            {
                OutlookSession.DeleteMessageImpl(storeId, entryId, false);
                return(true);
            }

            PairIDs folderIds = OutlookSession.GetDeletedItemsFolderIDs(storeId);

            if (folderIds == null)
            {
                OutlookSession.DeleteMessageImpl(storeId, entryId, false);
                return(true);
            }

            string    folderID = null;
            IEMessage message  = OutlookSession.OpenMessage(entryId, storeId);

            if (message == null)
            {
                return(false);
            }
            using ( message )
            {
                folderID = message.GetBinProp(MAPIConst.PR_PARENT_ENTRYID);
            }
            if (folderID != null)
            {
                if (folderID != folderIds.EntryId)
                {
                    if (MoveMessage(storeId, entryId, folderID, folderIds))
                    {
                        return(true);
                    }
                }
            }
            OutlookSession.DeleteMessageImpl(storeId, entryId, false);
            return(true);
        }