Search for the absence of text in email body - vba

Everyday, I receives nearly 100+ emails which contain the following.
CRM Status: Open
CRM Interaction Number: XXXXX
On some emails Status and Number are missing.
Example:
CRM Status:
CRM Interaction Number:
I need to look manually and categorize as "Not Ticketed".
Is there a way to find how many emails don't have the Ticket# and Status.

Is there a way that a VBA can use to find out how many emails doesn't have the Ticket# and Status.
The Outlook object model provides the Find/FindNext and Restrict methods of the Items class. You can read more about these methods in the following articles:
How To: Use Find and FindNext methods to retrieve Outlook mail items from a folder (C#, VB.NET)
How To: Use Restrict method to retrieve Outlook mail items from a folder
Also, you may find the AdvancedSearch method of the Application class helpful.
The key benefits of using the AdvancedSearch method in Outlook are:
The search is performed in another thread. You don’t need to run another thread manually since the AdvancedSearch method runs it automatically in the background.
Possibility to search for any item types: mail, appointment, calendar, notes etc. in any location, i.e. beyond the scope of a certain folder. The Restrict and Find/FindNext methods can be applied to a particular Items collection (see the Items property of the Folder class in Outlook).
Full support for DASL queries (custom properties can be used for searching too). You can read more about this in the Filtering article in MSDN. To improve the search performance, Instant Search keywords can be used if Instant Search is enabled for the store (see the IsInstantSearchEnabled property of the Store class).
You can stop the search process at any moment using the Stop method of the Search class.
Read more about this method in the Advanced search in Outlook programmatically: C#, VB.NET article.

Related

How can I automatically forward an outlook meeting based on the meeting category or when it's marked private?

I'm trying to automatically forward meetings from my work email to my personal email whenever I flag a meeting as private. I don't really even know where to start. Any one able to help me out?
I've tried looking for solutions based on the category of the meeting but that hasn't yielded any resulted either
You can create a VBA macro where you could handle changes to items by using the Items.ItemChange or AppointmentItem.PropertyChange events. When appointment items marked as private the following property is set under the hood:
Appointment.Sensitivity = olPrivate
So, you need to track changes made to the AppointmentItem.Sensitivity property which returns or sets a constant in the OlSensitivity enumeration indicating the sensitivity for the Outlook item.
But I'd suggest starting from the Getting started with VBA in Office article to be more familiar with VBA environment.

How to setup rule for emails that contains specific words in top email body only?

I created a rule that moves emails that contains a specific word in body to another folder.
It applies whenever that word is in body of older emails down the thread (when you scroll down to older emails that were replied to).
I need it to identify that word within the most recent email body only (and disregard the rest of the thread).
Outlook doesn't distinguish old email bodies and new ones. The message body is a single string. The best what you can do is to compare the message body of two items from the same conversation and extract the newer part. So, following that you will be able to recognize whether a keyword is a part of the newer message or not. The GetConversation method obtains a Conversation object that represents the conversation to which this item belongs. A conversation represents one or more items in one or more folders and stores.
Use the Find/FindNext or Restrict methods of the Items class to find items that correspond to the specified condition. Read more about them with code examples in the following articles:
How To: Use Find and FindNext methods to retrieve Outlook mail items from a folder (C#, VB.NET)
How To: Use Restrict method to retrieve Outlook mail items from a folder
Also you may find the AdvancedSearch method of the Application class helpful. The key benefits of using the AdvancedSearch method in Outlook are:
The search is performed in another thread. You don’t need to run another thread manually since the AdvancedSearch method runs it automatically in the background.
Possibility to search for any item types: mail, appointment, calendar, notes etc. in any location, i.e. beyond the scope of a certain folder. The Restrict and Find/FindNext methods can be applied to a particular Items collection (see the Items property of the Folder class in Outlook).
Full support for DASL queries (custom properties can be used for searching too). You can read more about this in the Filtering article in MSDN. To improve the search performance, Instant Search keywords can be used if Instant Search is enabled for the store (see the IsInstantSearchEnabled property of the Store class).
You can stop the search process at any moment using the Stop method of the Search class.
Read more about that in the Advanced search in Outlook programmatically: C#, VB.NET article.

How to move emails with same subject of one selected email?

I want to move emails from one folder to another based on the selection of one item.
If I choose one email I want all email with a similar subject to be moved from that folder into another folder (we can sort by subject and move the email, this may be faster).
Also I want to calculate response time of first received email with same subject and the response time of the email which I have replied at the last.
Moving one email is working.
Example
Subject of the email: Need data
Received at 1 AM, acknowledged at 1:10 AM and responded at 1:40 AM
In that case I need to calculate the timings as 40 MIN
i have tried selecting one email and run the macro and it is moving to another folder correctly but i need all the similar subject of the has to be moved faster
To find items that correspond to your conditions in Outlook you may use the following methods:
Find/FindNext - read more about these methods in the How To: Use Find and FindNext methods to retrieve Outlook mail items from a folder (C#, VB.NET) article.
Restrict - read more about this method in the How To: Use Restrict method to retrieve Outlook mail items from a folder article.
AdvancedSearch - see Advanced search in Outlook programmatically: C#, VB.NET for more information.
The Move method can be used for moving items into another folder.

Searching across inbox, calendar, tasks and notes in Outlook to display in single view

I have added the same category and / or string of text to items in inbox, calendar, tasks and notes. I would like to see them in a single view.
I would assume this would be done via a search, but I don't know how to do that across the whole of outlook?
Thanks
You can use the AdvancedSearch method of the Application class.
The key benefits of using the AdvancedSearch method in Outlook are:
The search is performed in another thread. You don’t need to run another thread manually since the AdvancedSearch method runs it automatically in the background.
Possibility to search for any item types: mail, appointment, calendar, notes etc. in any location, i.e. beyond the scope of a certain folder. The Restrict and Find/FindNext methods can be applied to a particular Items collection (see the Items property of the Folder class in Outlook).
Full support for DASL queries (custom properties can be used for searching too). You can read more about this in the Filtering article in MSDN. To improve the search performance, Instant Search keywords can be used if Instant Search is enabled for the store (see the IsInstantSearchEnabled property of the Store class).
Finally, you can stop the search process at any moment using the Stop method of the Search class.
Take a look at the Advanced search in Outlook programmatically: C#, VB.NET article for more information.

can we automate global address list in outlook 2010 using VBA

Can We automate adding/ deleting contacts from Global Address List.
I am trying to develop a tool for my Manager which will add an email to Global Address List when a new person joins our team, remove if a person leaves our team.
I tried searching online but couldn't find data related to same.
Thank in advance.
The Global Address List differs from Contacts folders in that it is not supposed to be editable by users. Each entry in the GAL generally represents an Exchange Mailbox/user; changes are made by Exchange administrators. There is also no way to edit the GAL via the Outlook Object Model. You need to use other tools to do that - see here:
Updating User Information in the Exchange GAL - Slipstick Systems
http://www.slipstick.com/exchange/updating-user-information-in-the-exchange-gal/
If it is actually Outlook Contacts that you want to work with, then you can easily use the Outlook Object Model to add or delete ContactItem objects in specific folders.
Object model (Outlook 2013 developer reference)
http://msdn.microsoft.com/en-us/library/ff866465.aspx