Subscribe to Subscribers
Talk to Webmaster Tony John


Resources » Code Snippets » C# Syntax

Get Contact information from outlook using C#


Posted Date:     Category: C# Syntax    
Author: Member Level: Gold    Points: 7



 


The following Code sample guide you to get contact information form outlook ( 2003 or 2007). Before using this code, you need to refer “Microsoft outlook object libary “ in you project .

Note 1: To execute this code outlook must be running in the machine.

Note 2: You have to create an alias for a namespace “Microsoft.Office.Interop.Outlook”
like using Outlook = Microsoft.Office.Interop.Outlook;


    
private List GetContacts(string findLastName)
{
List foundContacts = new List();
Outlook.Application outlookApp = new Outlook.ApplicationClass();
Outlook.MAPIFolder folderContacts = outlookApp.ActiveExplorer().Session.
GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
Microsoft.Office.Interop.Outlook.Items searchFolder = folderContacts.Items;

foreach (Microsoft.Office.Interop.Outlook.ContactItem foundContact in searchFolder)
{
if (foundContact.LastName.Contains(findLastName))
{
foundContact.Display(false);
foundContacts.Add(foundContact);
}
}


return foundContacts;
}






Did you like this resource? Share it with your friends and show your love!


Responses to "Get Contact information from outlook using C#"
Author: Curve Technologies    06 Sep 2008Member Level: Bronze   Points : 0
This appears to be a good example!!


Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: How to add Contact information to Outlook using C#
    Previous Resource: List Controls from Different Collections
    Return to Resources
    Post New Resource
    Category: C# Syntax


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    Contact  .  Outlook  .  Get contact information from outlook  .  



    Follow us on Twitter: https://twitter.com/dotnetspider

    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.