My company has a purchase order in to buy the full version, so right now using the downloaded trial.
To start off with I create a pst, then create a inbox folder with 0 messages in it .
TEST 1:
(1) I then call the below method passing in numberOfMessagesToCreate = 100.
Result: It only creates a total of 50 messages and then no new messages can then be added to that folder.
TEST 2
(2) If I do the following steps:
(A) Pass in numberOfMessagesToCreate= 20, it creates 20
(B) Pass in numberOfMessagesToCreate= 20, it creates 20
(C) Pass in numberOfMessagesToCreate= 20, it creates 10
Result: It only creates a total of 50 messages and no new messages can then be added to that folder.
public void CreateBulkEmails(
FolderInfo FolderToCreateIn,
string FromEmailAddress,
string ToEmailAddress,
string Subject,
string Body,
Int32 numberOfMessagesToCreate,
OnErrorMessage passedInErrorHandler,
OnFeedBackMessage passedInFeedBackHandler
)
{
Int32 messageCount = 0;
passedInFeedBackHandler("Creating Bulk Messages. Please wait.");
screenFeedbackStart = DateTime.Now;
MailMessage mailMsg = null;
MapiMessage outlookMsg = null;
FolderInfo targetFolder = null;
try
{
for (int i = 0; i < numberOfMessagesToCreate; i++)
{
switch (passedInFeedBackHandler != null)
{
case true:
screenFeedbackElapsed = DateTime.Now - screenFeedbackStart;
switch (screenFeedbackElapsed.Seconds >= 4)
{
case true:
screenFeedbackStart = DateTime.Now;
passedInFeedBackHandler("Creating Bulk Message #" + i + ". Please wait.");
break;
}
break;
}
messageCount++;
#region Message Creation
#region Setup MailMessage
// Create an instance of the MailMessage class
mailMsg = new MailMessage();
mailMsg.From = FromEmailAddress;
mailMsg.To = ToEmailAddress;
mailMsg.Date = DateTime.Now;
mailMsg.Subject = Subject;
mailMsg.Body = Body;
#endregion
#region Setup MapiMessage from MailMessage
// Create an instance of the MapiMessage class and pass MailMessage as argument
outlookMsg = MapiMessage.FromMailMessage(mailMsg);
#endregion
//add msg to PSt store
FolderToCreateIn.AddMessage( outlookMsg );
}
#endregion
}
catch (Exception error)
{
switch (passedInErrorHandler != null)
{
case true:
passedInErrorHandler(error.Message);
break;
}
}
switch (passedInFeedBackHandler != null)
{
case true:
passedInFeedBackHandler("Ready");
break;
}
}v