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

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.

Related

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.

Office365: Checklist and Workflow

We use Office365 and am looking to create a number of equipment inspection checklists where a user would go to a One-Drive link, open a checklist template, use the checklist during equipment inspection and make comments, then upon completion save the document with a machine generated name (apparatus and date-based) to a folder on One-Drive. In addition, if an item(s) on the checklist is out of spec, a separate email will be sent to a specified email address with info about the defect.
I have looked at MS Forms and it seems very clunky for this application as there are many items on the checklist. I could create it as an macro-automated Word document, but that seems a bit old-fashioned.
What is the right way to do this? Are there any examples of this that I could learn from? Thank you.
You should build this as a standard custom list in a SharePoint site. Each of your checklist items becomes a separate field in the list, and thus every New entry in the list is one complete checklist. I know this seems a little sideways since your checklist items are columns -- but the New Item form and Edit form present the fields for that item in a vertical fashion making it appear more like a check list that the user can interact with. This then gives you a table listing of everyone's checklist that you could filter and sort and even fire Power Automate Flows based on statuses. Once complete, you can use a Flow to generate a Word document or PDF document and save it in a library or OneDrive.
You can provide users with a hyperlink directly to that list's entry form (e.g. https://yourtenant.sharepoint.com/sites/checklistsite/lists/checklist/NewForm.aspx). If the default entry form does not meet your needs, you can always customize the list form with PowerApps.

Search for the absence of text in email body

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.

How can i know that a meeting is already created or not?

Is there a way i can find out if the current meeting window from which i opened the add-in (compose mode) is from a new meeting or from an already created meeting that i opened for edit?
Currently this feature, you requested, is not a part of the product. We track Outlook add-in feature requests on our user-voice page. Please add your request there. Feature requests on user-voice are considered when we go through our planning process.
There are a lot of use cases where this is relevant:
I believe the purpose of many add-ins is to augment the item (e.g. appointment/meeting or email), the user is currently reading or composing. This is usually done in a 3rd party system by associating the meeting in Exchange with a "record" in a separate system. To find out if the current meeting is already associated with a "record" (and possibly display the contents of it), you need a way to identify the meeting obviously. If it's a new meeting, you know there isn't a "record", however if it's an existing meeting, you need to be able to identity it. Exposing itemId in compose mode would satisfy this need. And by the way, the feature is already requested on User Voice!
I can only speculate as to why Microsoft haven't added the feature yet, but I think Office JS started out with support for emails. Compose-mode for emails is almost exclusively for authoring new (unsent) emails, hence they would never have an itemId.
This is not the case for appointments and meetings, however. They are frequently being edited after they have been created, as meetings are often rescheduled, augmented with a more detailed agenda, etc.
Unfortunately the workaround of using saveAsync to obtain the itemId has several drawbacks as you already alluded to: it's very intrusive as it will leave behind "ghost" meetings (as the user now can't regret saving an appointment/meeting) and it causes the sending of spurious meeting update requests to attendees, etc. And it doesn't work in Outlook for Mac! - one of the big selling points of this add-in technology compared to VSTO/COM-add-ins.
At my company we have attempted several times to port our existing VSTO add-in to Office JS, but everytime we stall on this exact issue, as the drawbacks are simply to many!
However, an approach - besides maybe using some crude heuristics - we have thought about, goes like this:
1) Via EWS (or MS Graph), augment every meeting(!) of every user(!) with a custom add-in property containing the itemId. See: https://stackoverflow.com/a/43140644/10752973 on how to set custom properties from the "outside".
2) When the add-in is opened, see if the custom property is present. If the custom property is there, it's an existing appointment/meeting (and you'll know its itemId). If it isn't there, it's a new appointment.
As I said, we haven't implemented it, but in theory it might work. But it's such a huge hassle (and will burden both the Exchange server and the application itself), for something so simple. We would effectively also need to monitor each mailbox in Exchange to detect newly creating appointment/meetings in order to augment them with the custom property, which is needlessly complex.
But I hope this answer might convince the Outlook Add-ins Team to reconsider adding support for obtaining itemId in compose-mode for appointments/meetings.

Deleting event collections in Keen.io

When our keen.io project was started, there were a bunch (hundreds?) of event collections accidentally created due to the names being changed dynamically (i.e. viewed page blog name X, viewed page blog Y, viewed page blog Z, etc). Does anyone know of an efficient way to delete all these collections (i.e. that does not involve deleting them one by one in the UI or via API)?
If I was able to query all the event collection names we have in our project, then I could easily loop through all the event collections and delete via the API, but I haven't found a way to get the event collection list back in a query.
Issuing a GET request to the Events resource returns schema information for all the event collections in a project, including properties and their types.
https://keen.io/docs/api/reference/#event-resource
keen-gem has an event_collections method that wraps this functionality if you're into Ruby.
It's best to loop through the schema one collection at a time as deleting many collections in parallel can lead to rate limiting.