Read/Write Office Outlook contacts from .NET

0.00 avg. rating (0% score) - 0 votes

1. Install Office XP/2003/2007
2. Add COM reference to Microsoft Outlook 10/11/12 Object Library


Imports msoutlook = Microsoft.Office.Interop.Outlook


‘read

Dim outlookApp As New msoutlook.Application()

Dim outlookNS As msoutlook.NameSpace = outlookApp.GetNamespace(“MAPI”)

Dim theContacts As msoutlook.MAPIFolder = outlookNS.GetDefaultFolder(msoutlook.OlDefaultFolders.olFolderContacts)

For Each contact As Microsoft.Office.Interop.Outlook.ContactItem In theContacts.Items

Console.WriteLine(contact.FileAs)

Debug.WriteLine(contact.FileAs)

Next


‘create new

Dim cnt As msoutlook.ContactItem = CType(outlookApp.CreateItem(msoutlook.OlItemType.olContactItem), msoutlook.ContactItem)

cnt.FileAs = “New Contact”

cnt.MobileTelephoneNumber = “1234567”

cnt.Save()

0.00 avg. rating (0% score) - 0 votes
ToughDev

ToughDev

A tough developer who likes to work on just about anything, from software development to electronics, and share his knowledge with the rest of the world.

One thought on “Read/Write Office Outlook contacts from .NET

  • October 7, 2017 at 6:25 pm
    Permalink

    Hi
    We can help your website to get on first page of Google and increase the number of leads and sales you are getting from your website. Please email us back for full proposal.

    Best Regards
    Andy

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>