Forum Discussion
cunderw
8 years agoCommunity Hero
So I don't think there is a good way for this to work with R&P, but you can access your inbox and folders and search through them via scripting and OleObject.
If you're using JavaScript here is a little snippet that will search the specific inbox of an account for a subject that contains a specified search term.
function searchOutlook(accountName,searchTerm) {
const outlook = Sys.OleObject("Outlook.Application");
const mapi = outlook.GetNamespace("MAPI");
const inbox = mapi.Folders.Item(accountName);
const messages = inbox.Folders.Item("Inbox");
for(let i = 1; i < messages.Items.Count; i++) {
if(messages.Items.Item(i).Subject.search(searchTerm) > -1) {
Log.Message("Found Email At Position: " + i);
messages.Items.Item(i).Display();
break;
}
}
}