locked
How to retrieve all MS Office outlook 2007 contacts in ASP.net with C#/vb ? RRS feed

  • Question

  • User-270144839 posted

     Please help me to retrieve all outlook contacts to asp.net application

    Thursday, July 3, 2008 2:19 AM

Answers

  • User-583891309 posted

     using System.Windows.Forms;
    using Outlook = Microsoft.Office.Interop.Outlook;
    using Office = Microsoft.Office.Core;

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 3, 2008 7:48 AM

All replies

  • User-1829657710 posted

    You will find that Outlook is client based and generally not recomended to be installed on the web server. If it is just the contacts that you want to pull from an exchange system that is another story.

    With Exchange 2007 you could always tag into the Exchange Web services to collect the data, if running exchange 2003 you should look at the SDK as I am sure there are examples there.

    Thursday, July 3, 2008 7:40 AM
  • User-583891309 posted

     Use this code in the App_start or on any event where you want to view contacts

    Outlook.AddressLists addrLists;

    Outlook.Folder contactsFolder = Application.Session.GetDefaultFolder( Outlook.OlDefaultFolders.olFolderContacts) as Outlook.Folder;

    addrLists = Application.Session.AddressLists;

    foreach (Outlook.ContactItem item in contactsFolder.Items)

    { MessageBox.Show(item.FirstName); }

    Thursday, July 3, 2008 7:44 AM
  • User-270144839 posted

    sorry i can't find this OUtlook namespace ?

    do i need to import any namespace.........or add reference for this OUtlook ?

    Thursday, July 3, 2008 7:47 AM
  • User-583891309 posted

     using System.Windows.Forms;
    using Outlook = Microsoft.Office.Interop.Outlook;
    using Office = Microsoft.Office.Core;

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 3, 2008 7:48 AM