Esempio n. 1
0
        private void DoMoveBetweenStorages(IResource resMail, IEMessage message, PairIDs messageIDs, PairIDs selectedFolderIDs)
        {
            using ( message )
            {
                IEFolder folder =
                    OutlookSession.OpenFolder(selectedFolderIDs.EntryId, selectedFolderIDs.StoreId);
                if (folder == null)
                {
                    return;
                }
                using ( folder )
                {
                    IEMessage newMessage = folder.CreateMessage("IPM.note");
                    using ( newMessage )
                    {
                        message.CopyTo(newMessage);
                        string entryID = newMessage.GetBinProp(MAPIConst.PR_ENTRYID);
                        OutlookSession.SaveChanges(true, "Save mail for moving between storages resource id = " + resMail.Id, newMessage, entryID);
                        if (_copy)
                        {
                            return;
                        }

                        if (!string.IsNullOrEmpty(entryID) && !resMail.HasProp(-PROP.Attachment))
                        {
                            new ResourceProxy(resMail).SetProp(PROP.EntryID, entryID);
                        }
                        OutlookSession.DeleteMessage(messageIDs.StoreId, messageIDs.EntryId, false);
                    }
                }
            }
        }
Esempio n. 2
0
            /// <summary>
            /// Method handles the deletion of a Contact resource from any supported
            /// AB. Because of the particular definition of watched resource list
            /// we have no need to check given resource (e.Resource) for actual
            /// belonging to the AB.
            /// </summary>
            private void OnImportedContactDeleting(object sender, ResourceIndexEventArgs e)
            {
                string storeID = _importedAB.GetStringProp(PROP.StoreID);

                if (storeID != null)
                {
                    OutlookSession.DeleteMessage(storeID, e.Resource.GetStringProp(PROP.EntryID), true);
                    Contact.RemoveFromSync(e.Resource);
                }
            }
Esempio n. 3
0
 private void OnTaskDeleted(object sender, ResourceIndexEventArgs e)
 {
     if (Settings.ExportTasks)
     {
         PairIDs IDs = PairIDs.Get(e.Resource);
         if (IDs != null)
         {
             OutlookSession.DeleteMessage(IDs.StoreId, IDs.EntryId, true);
         }
     }
 }
Esempio n. 4
0
 public static void DeleteMail(IResource mail, PairIDs pairIDs, bool deletedItems)
 {
     if (deletedItems)
     {
         IResource folder = mail.GetLinkProp(PROP.MAPIFolder);
         if (folder != null)
         {
             deletedItems = !Folder.IsIMAPFolder(folder);
         }
     }
     if (pairIDs != null)
     {
         OutlookSession.DeleteMessage(pairIDs.StoreId, pairIDs.EntryId, deletedItems);
     }
     Core.ResourceAP.QueueJob(JobPriority.Immediate, new ResourceDelegate(Mail.Delete), mail);
 }
Esempio n. 5
0
 public void Exec(IResource resource, IActionParameterStore actionStore)
 {
     Tracer._Trace("Execute rule: DeleteMessageRuleAction");
     if (resource == null || resource.Type != STR.Email)
     {
         return;
     }
     try
     {
         PairIDs messageIDs = PairIDs.Get(resource);
         OutlookSession.DeleteMessage(messageIDs.StoreId, messageIDs.EntryId, true);
     }
     catch (Exception exception)
     {
         Tracer._TraceException(exception);
     }
 }
Esempio n. 6
0
        public void DeleteMessage(string entryID)
        {
            IResource mail = Core.ResourceStore.FindUniqueResource(STR.Email, PROP.EntryID, entryID);

            if (mail != null)
            {
                PairIDs mailIDs = PairIDs.Get(mail);
                if (mailIDs != null)
                {
                    OutlookSession.DeleteMessage(mailIDs.StoreId, entryID, false);
                }
                else
                {
                    Mail.ForceDelete(mail);
                }
            }
        }