Outlook has a really easy way to create a contact from an email message: right click on an address in the From, To, or CC field and choose Add to Outlook Contacts. This creates a contact with the display name and email address entered into a new Contact form.
That's how it works in older versions of Outlook but it doesn't work like this in Outlook 2013 and it's very frustrating.
In Outlook 2013, your experience will vary when you are signed in to LinkedIn or Facebook using the Social Connector. If Outlook finds a match in Facebook or LinkedIn, Outlook thinks a contact exists and Edit Contact is enabled. If you click Save, an Outlook Contact is created, using the LinkedIn name (which may not be the display name used on the message). The email address is added only if you are linked to the person on LinkedIn.
Fortunately, I can use a macro to create a contact for the sender. I often save contacts in my SharePoint contacts folder and the macro can handle that too.
I'm using one macro to set the destination folder then calling a second macro to create the contact in that folder. This allows me to use several Contact folders as the destination, without repeating the entire code over and over.
No-macro method: drag the message to People in the Folder Bar to create a new contact for the sender in the default Contacts folder.
Create Contacts for Email Senders
To use this macro, create buttons on the ribbon for each macro that sets a folder. Then select a message in the message list and click one of the buttons.
Public objDestFolder As Outlook.Folder Sub SaveInSPS() Dim objNS As Outlook.NameSpace Set objNS = Application.GetNamespace("MAPI") Set objDestFolder = objNS.Folders("SharePoint Lists").Folders("SPS Contacts") ' After setting the folder, call the macro that creates the contact CreateContactFromMail End Sub Sub CreateContact() Dim objNS As Outlook.NameSpace Set objNS = Application.GetNamespace("MAPI") Set objDestFolder = objNS.GetDefaultFolder(olFolderContacts) ' After setting the folder, call the macro that creates the contact CreateContactFromMail End Sub Sub CreateContactFromMail() Dim ObjItem As ContactItem Dim sSenderName As String Dim oMail As Outlook.MailItem ' to work with open or selected messages, use the ' GetCurrentItem() function from http://slipstick.me/e8mio Set oMail = Application.ActiveExplorer.Selection.Item(1) sSenderName = oMail.SentOnBehalfOfName If sSenderName = ";" Then sSenderName = oMail.SenderName End If Debug.Print Set ObjItem = objDestFolder.Items.Add(olContactItem) With ObjItem .Body = oMail.Subject .Email1Address = oMail.SenderEmailAddress .Email1DisplayName = sSenderName .Email1AddressType = oMail.SenderEmailType .FullName = oMail.SenderName .Display End With Set objDestFolder = Nothing Set ObjItem = Nothing Set objDestFolder = Nothing End Sub
How to use macros
First: You will need macro security set to low during testing.
To check your macro security in Outlook 2010 or 2013, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, it’s at Tools, Macro Security.
After you test the macro and see that it works, you can either leave macro security set to low or sign the macro.
Open the VBA Editor by pressing Alt+F11 on your keyboard.
To put the code in a module:
- Right click on Project1 and choose Insert > Module
- Copy and paste the macro into the new module.
More information as well as screenshots are at How to use the VBA Editor