Пример #1
0
 /// <summary>
 /// Moves Mail item into new folder
 /// </summary>
 /// <param name="newFolder" - Folder object representing Folder to move to></param>
 public void Move(MailFolder newFolder)
 {
     _mailitem = _mailitem.Move(newFolder.OutlookFolderItem);
 }
Пример #2
0
 /// <summary>
 /// This method registers or unregisters folder event monitoring.
 /// </summary>
 /// <param name="operation">name of the operation</param>
 /// <param name="folder">Outlook folder</param>
 /// <param name="register">True to register folder event monitoring, False to unregister folder event monitoring</param>
 private bool RegisterFolderEvent(string operation, MailFolder folder, bool register)
 {
     try
     {
         if (register)
         {
             folder.RegisterItemAddEventHandler(FolderMonitorEvent);
             FolderEventList.Add(folder);
             Log.Out(Log.Severity.Info, operation, "Registered event to " + folder.FolderPath);
         }
         else
         {
             folder.UnRegisterItemAddEventHandler();
             Log.Out(Log.Severity.Info, operation, "Unregistered event to " + folder.FolderPath);
         }
     }
     catch (Exception ex)
     {
         Log.Out(Log.Severity.Error, operation, "RegisterFolderEvent: Exception encountered\n" + ex.ToString());
         return false;
     }
     return true;
 }
Пример #3
0
        /// <summary>
        /// This method returns matching subfolders of the folder.
        /// </summary>
        /// <param name="operationName">name of the operation</param>
        /// <param name="rootFolder">the root folder to retrieve subfolders</param>
        /// <param name="folderName">folder name for searching subfolders</param>
        /// <returns>list of sub folders that matches the folderName</returns>
        private List<MailFolder> GetMatchingSubFolders(string operationName, MailFolder rootFolder, string folderName)
        {
            List<MailFolder> matchingFolders = new List<MailFolder>();
            MailFolders subFolders = rootFolder.GetSubFolders();

            if (subFolders.Count == 0)
            {
                Log.Out(Log.Severity.Warning, operationName, "No subfolder in folder {0}", rootFolder.Name);
            }

            foreach (MailFolder folder in subFolders)
            {
                // we just copy all the folders to the list if folderName is not specified
                if (string.IsNullOrEmpty(folderName) || folder.Name.Contains(folderName))
                {
                    matchingFolders.Add(folder);
                }
            }

            return matchingFolders;
        }
Пример #4
0
 /// <summary>
 /// Moves Mail item into new folder
 /// </summary>
 /// <param name="newFolder" - Folder object representing Folder to move to></param>
 public void Move(MailFolder newFolder)
 {
     _mailitem = _mailitem.Move(newFolder.OutlookFolderItem);
 }