Outlook VBA Restrict on All Items - vba

I was hoping to find a way to get an Outlook items collection for all items, regardless of what folder they may be sitting in so I can do a restrict on every item, no matter where someone may have moved it. Does anyone know if this is possible? I was poking around in the Outlook object model but I couldn't find anything.

You can use Application.AdavncedSearch to search the top level folder of the store including subfolders. Keep in mind that the search is asynchronous, so you will need to wait for the Application.AdvancedSearcvhComplete event to fire.

Related

Outlook VBA: how to retrieve the folder(s) from the taskbar Move menu list?

I am trying to retrieve via VBA the last entry (or all entries) of the directories list shown in the Move menu of Outlook. This menu is normally visible in the Home taskbar. The objective is thereafter to re-use this directory for instance to "change focus window to the last used folder" (from this list).
I have checked in the Microsoft documentation but could not find it, though I might have missed it.
I also didn't find it in the OlDefaultFolders list, which is logical since it's not a folder in the tree view anyway, but only a list of recently used folders.
I did look into this thread but the objective of the question author seems a bit different as there is no question of the Move menu: Get the folder where the last mailitem was moved in Outlook?
Did anyone had the same issue or find a way to circumvent this problem?
Maybe to store the last used folder elsewhere each and every time an email is moved... a bit overkill but that could work I guess.
Thanks in advance for your help!

Automatically take specific data out of specific emails and put it into an excel form

I'm completely new to VBA.
Is it possible to write some code that would search for emails from a specific sender and search inside that email for a specific line in a table, which it would then put into an already existing excel form?
Any advice on where to get started learning this or if it's even possible would be greatly appreciated.
it is possible to make that. You have three types to search something like that.
You have the View, AdvancedSearch and the Explorer.Search.
The View is only for one folder.
The Filter for the View is called Distributed Authoring Search and Location (DASL). Here is a good link for that filter type: https://msdn.microsoft.com/en-us/library/ms874577(v=exchg.65).aspx
The AdvancedSearch is like the View, but you can search over all folders and all nameboxes. BUT there is problem! When you use AdvancedSearch you have to create an folder and in this folder are your results. The filter of the folder is unchangebel, so after creading you cant change anything. The folder will update Automaticly if there are new Mail or something else. The AdvancedSearch uses the same filter as View.
The last one is the Explorer.Search. With that search you can search like the AdvancedSearch, but you have not to create an folder. This one uses the Advanced Query Syntax (AQS). Here is a good link for that filter type: https://msdn.microsoft.com/en-us/library/cc513841(v=office.12).aspx Each of the searches can filter for all typs of objects. So you can Search for things in Mails.
Text in mails is Called in..
- DASL textdescription.
- AQS contents.
I hope I could help you by starting.

VB Code to Close Open Subfolders in Outlook

Outlook has an habit of opening sub-folders if an email has been sent to it automatically (through rules). There is no way to turn off this feature.
Does anyone have ideas for code that would periodically (say every 30 seconds), automatically collapse all subfolders within, say, the sent items folder?
Thx
The Outlook object model doesn't provide anything for collapsing folders in the navigation pane.
The Starting Outlook with all folders collapsed/expanded states the following:
To keep the mailbox collapsed even when a new message is being delivered, make sure that your Inbox and other folders that receive email (for instance by a rule) have been added to your Favorites list.

Using Outlook Redemption with VB

Ok so here is what I am trying to do: I need to access a bunch of PSTs on my computer, cycle through each email and make a modification to a text tag in the email then finish up with the same PST + modifications. I have found out that I need to use Outlook Redemption with Visual Basic (2010) but I have never used either. Any help would be greatly appreciated!
Create an RDOSession object.
Call RDOSession.LogonPstStore.
Enumerate RDOFolders collection under PSTStore.IPMRootFolder.
Recursively enumerate RDOFolders collection of each folder if desired.
Check the RDPFolder.DefaultMessageClass to make sure it contains the type of item you're looking for.
Enumerate the items in the folder.

Outlook Interop Copy MailItem

I know I've seen this question before but I can't seem to find it again.
I want to use Microsoft Interop to copy a mail message from the inbox to a differnt folder. I know that other objects like appointment, and folder both have a CopyTo() method, but it is missing for MailItem. The way I do it now is call MailItem.Copy and then move the copy to another folder. I don't like this because it causes some "flicker" on the screen in outlook where you can see the Inbox grow and shrink as the emails are copied then moved.
Is there another solution?
Thanks
Sad but this is the only way...
Look at http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/3dd2bd06-5738-4fb2-b628-0d7ab2be8157/