Example #1
0
            private void MoveMessage(FolderDescriptor source, FolderDescriptor destination)
            {
                IEFolder srcFolder =
                    OutlookSession.OpenFolder(source.FolderIDs.EntryId, source.FolderIDs.StoreId);

                Assert.IsNotNull(srcFolder);
                using ( srcFolder )
                {
                    IEFolder destFolder =
                        OutlookSession.OpenFolder(destination.FolderIDs.EntryId, destination.FolderIDs.StoreId);
                    Assert.IsNotNull(destFolder);
                    using ( destFolder )
                    {
                        srcFolder.MoveMessage(_messageID, destFolder);
                    }
                }
            }
Example #2
0
 private static bool MoveMessage(string storeID, string entryID, string folderID, PairIDs delFolderIds)
 {
     if (folderID == null)
     {
         return(false);
     }
     if (folderID != delFolderIds.EntryId)
     {
         IEFolder delFolder = OutlookSession.OpenFolder(delFolderIds.EntryId, delFolderIds.StoreId);
         if (delFolder == null)
         {
             return(false);
         }
         using ( delFolder )
         {
             IEFolder folder = OutlookSession.OpenFolder(folderID, storeID);
             if (folder == null)
             {
                 return(false);
             }
             using ( folder )
             {
                 try
                 {
                     folder.MoveMessage(entryID, delFolder);
                     return(true);
                 }
                 catch (COMException exception)
                 {
                     _tracer.TraceException(exception);
                     StandartJobs.MessageBox("Cannot complete deleting mail. Reason: " + exception.Message, "Error",
                                             MessageBoxButtons.OK, MessageBoxIcon.Error);
                     return(false);
                 }
             }
         }
     }
     return(false);
 }
Example #3
0
        private void DoMoveImpl(IEMessage message, PairIDs messageIDs, PairIDs selectedFolderIDs)
        {
            string parentID = string.Empty;

            using ( message )
            {
                parentID = message.GetBinProp(MAPIConst.PR_PARENT_ENTRYID);
            }
            IEFolder parentFolder =
                OutlookSession.OpenFolder(parentID, messageIDs.StoreId);

            if (parentFolder == null)
            {
                return;
            }

            using ( parentFolder )
            {
                IEFolder folder =
                    OutlookSession.OpenFolder(selectedFolderIDs.EntryId, selectedFolderIDs.StoreId);
                if (folder == null)
                {
                    return;
                }
                using ( folder )
                {
                    if (_copy)
                    {
                        parentFolder.CopyMessage(messageIDs.EntryId, folder);
                    }
                    else
                    {
                        parentFolder.MoveMessage(messageIDs.EntryId, folder);
                    }
                }
            }
        }