Using Outlook Redemption with VB - vb.net

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.

Related

Creation of an unique link to an outlook e-mail

Background:
Since all tasks, are more or less assigned per E-mail I want track the e-mail via a link in other programs (Project, Planner, Word, Excel, OneNote, ect). This should be possible via the globally unique identifier GUID of the Outlook message & the Outlook URL Protocol.
I can only find instructions on this for older versions - which does not work.
BTW: Tracking via searching on subjects is a pain, since subject changes and conversation history can be long.
Question:
How do generate a link to the e-mail in outlook 365 which is unique and can be opened in other programs (Project, Planner, Word, Excel, OneNote, ect)?
There are other ways possible? Add-in?
This should be It should be possible!
However I do not know how it works with Office 365 --> Pls see following website:
https://www.davidtan.org/create-hyperlinks-to-outlook-messages-folders-contacts-events/
Excerpt out of it:
The Windows operating system recognizes the outlook: tag and whenever it sees that it’s part of a link, it triggers outlook to do something. Depending how you format the hyperlink, you can open messages, folders, contacts and meetings stored in outlook from websites, documents (Word, OpenOffice etc), Excel spreadsheets and powerpoint presentations stored either locally or even over a shared network.
How To Link To Outlook Items:
Outlook Paths
Outlook provides a way to link to any Outlook item using a URL. It can be “path based” like this:
– Outlook:Inbox\
– Outlook:Personal Folders\Contacts\~John Doe
Outlook GUID
You can link to a globally unique identifier (GUID) that is created for an item and doesn’t change when you rename or move it:
– Outlook:000000000EAE44933247899468AC478B81C0BANDHEWR324
It is best to use the GUID URL since you don’t have to worry about changes breaking the link.
If you are after a outlook message, all you have to do is select that message in outlook, and then left-click on the linker icon on the lower right of the taskbar so that the link will get copied. Next, you will just have to paste it somewhere. It works the same way for contacts and even calendar events.
By default, the copied link will be something like this
Email subject here
If you are building a webpage using HTML, then you can merely copy and paste that code to the HTML file, and maybe just changing the link text.
However, if you are working in Excel, what is important is only the part that says:
Outlook:00000000CC63759F18171E46835E96E44971FDFB07006446
In Excel, press CTRL-K in a cell, enter any text you want to be displayed, and paste that piece of code above (ex. outlook:123437654) at the address section. That’s it.
However it does not work with OFFICE 365. May you can help me?
KR Christian

Outlook VBA Restrict on All Items

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.

Moving Emails to specific Outlook folders Using Access VBA

I'm using Microsoft Office 2013 to set up an access database linked to an inbox in outlook. I'm having no issues setting up a linked table and manipulating the data within access.
What I want to do is move the email from one outlook folder/subfolder to another outlook folder/subfolder with VBA code within Access. In other words, I want to click on a button within Access and activate VBA coding that moves the email within Outlook.
Any tips on how to get started will be greatly appreciated.
Use MailItem.Move and pass the target MAPIFolder object as the parameter.

Outlook 2007 - VBA macro in NormalEmail.dotm

I have a Word 2007 template that I use as Normal.dotm, which has corporate theme, styles, etc., plus a tiny bit of macro code that overrides the default behaviour of the bullet & number buttons on the ribbon.
I'd now like to use this same template when creating emails in Outlook 2007. I've tried just copying my Normal.dotm to NormalEmail.dotm, and to an extent this works, but although my macro is correctly invoked when I press the bullet/number buttons in the email editor, it gives an error:
Run time error 429: ActiveX component can't create object
On further investigation, it seems that anything I do within my macro that references an object in the normal Word object model (Application, Selection, etc.) causes this error. So, even if my macro consists of the following, it still fails:
MsgBox TypeName(Application)
I have an inkling that this is because I'm running in the context of Outlook, not Word, and so perhaps there is no (Word) application, or any of the objects associated with it. I know that the email editor in Outlook is Word-but-not-as-we-know-it-Jim.
Having said that, I did discover that ThisDocument does return a valid Document object; unfortunately, it corresponds to the template itself, not the email being edited.
By trial and error, I've discovered that I can get at the Document corresponding to the email by the following circuitous route (this displays the text in the email):
MsgBox ThisDocument.MailEnvelope.Item.Application.ActiveInspector.WordEditor.Content.Text
However, this code also seems to cause Outlook to crash - not at the time, but later, when you close Outlook.
At this point, I'm just about ready to admit defeat. No doubt the "correct" way to create macros in Outlook is to create them in Outlook itself, but from my limited experience, that's just horrible. (You can create macros in VBA, but you can't deploy them; or, you can create them in VSTO, but then you need an installer rather than simply deploying a template).
So. Any ideas out there that would let me do all that I hoped to do?
Override the behaviour of the bullet/number buttons on the ribbon in the email editor.
Deploy the macros in the NormalEmail.dotm file, rather than having to "install" them.
Not crash Outlook.
Have you tried adding the reference in the VBA editor to the Microsoft Outlook Object Library?
In Outlook 2007 you might also have to add VBA references to "Microsoft Word 12.0 Object Library" and maybe "Microsoft Forms 2.0 Object Library". Different versions may apply for other version years.
In addition, in the macro/code you have to set the objects to get/use the correct methods and properties.
I'm not an OO programmer and usually copy code from elsewhere and modify for my need so I can't help much more than what I said above. (And one of my macros is also giving me the same 429 error you get.)

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/