public static void Run()
{
// The path to the File directory.
// ExStart:SearchStringInPSTWithIgnoreCaseParameter
string dataDir = RunExamples.GetDataDir_Outlook();
string path = dataDir + "SearchStringInPSTWithIgnoreCaseParameter_out.pst";
if (File.Exists(path))
{
File.Delete(path);
}
using (PersonalStorage personalStorage = PersonalStorage.Create(dataDir + "SearchStringInPSTWithIgnoreCaseParameter_out.pst", FileFormatVersion.Unicode))
{
FolderInfo folderInfo = personalStorage.CreatePredefinedFolder("Inbox", StandardIpmFolder.Inbox);
folderInfo.AddMessage(MapiMessage.FromMailMessage(MailMessage.Load(dataDir + "Message.eml")));
PersonalStorageQueryBuilder builder = new PersonalStorageQueryBuilder();
// IgnoreCase is True
builder.From.Contains("automated", true);
MailQuery query = builder.GetQuery();
MessageInfoCollection coll = folderInfo.GetContents(query);
Console.WriteLine(coll.Count);
}
// ExEnd:SearchStringInPSTWithIgnoreCaseParameter
}
}