/// <summary> /// This method creates folders according to the parameters /// </summary> /// <param name="operation">parameters for FolderCreate</param> /// <returns>true if processed successfully, false otherwise</returns> private bool FolderCreate(MailSimOperationsFolderCreate operation) { int iterations = GetIterationCount(operation.Count); // gets the Outlook folder IMailFolder folder = olMailStore.GetDefaultFolder(operation.FolderPath); if (folder == null) { Log.Out(Log.Severity.Error, operation.OperationName, "Unable to retrieve folder {0}", operation.FolderPath); return(false); } // randomly generate the number of folders to create if (iterations == 0) { iterations = randomNum.Next(1, MaxNumberOfRandomFolder + 1); Log.Out(Log.Severity.Info, operation.OperationName, "Randomly creating {0} folders", iterations); } for (int count = 1; count <= iterations; count++) { Log.Out(Log.Severity.Info, operation.OperationName, "Starting iteration {0}", count); string newFolderName = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss.fff") + " - " + operation.FolderName; Log.Out(Log.Severity.Info, operation.OperationName, "Creating folder: {0}", newFolderName); folder.AddSubFolder(newFolderName); SleepOrStop(operation.OperationName, operation.Sleep); Log.Out(Log.Severity.Info, operation.OperationName, "Finished iteration {0}", count); } return(true); }
/// <summary> /// This method creates folders according to the parameters /// </summary> /// <param name="operation">parameters for FolderCreate</param> /// <returns>true if processed successfully, false otherwise</returns> private bool FolderCreate(MailSimOperationsFolderCreate operation) { int iterations = GetIterationCount(operation.Count); // gets the Outlook folder IMailFolder folder = olMailStore.GetDefaultFolder(operation.FolderPath); if (folder == null) { Log.Out(Log.Severity.Error, operation.OperationName, "Unable to retrieve folder {0}", operation.FolderPath); return false; } // randomly generate the number of folders to create if (iterations == 0) { iterations = randomNum.Next(1, MaxNumberOfRandomFolder + 1); Log.Out(Log.Severity.Info, operation.OperationName, "Randomly creating {0} folders", iterations); } for (int count = 1; count <= iterations; count++) { Log.Out(Log.Severity.Info, operation.OperationName, "Starting iteration {0}", count); string newFolderName = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss.fff") + " - " + operation.FolderName; Log.Out(Log.Severity.Info, operation.OperationName, "Creating folder: {0}", newFolderName); folder.AddSubFolder(newFolderName); SleepOrStop(operation.OperationName, operation.Sleep); Log.Out(Log.Severity.Info, operation.OperationName, "Finished iteration {0}", count); } return true; }