views:

493

answers:

3

I develop VB.net 2008 with C# Application for fetch appointment item from outlook 2003. I need to show the contact with their mobile number, which are stored in outlook contact related to the appointments in calender.

int i = 0;
Outlook.Application oApp = new Outlook.Application();
Outlook.NameSpace oNS = oApp.GetNamespace("MAPI");
oNS.Logon(Type.Missing, Type.Missing, false, true);
Outlook.MAPIFolder Ocalender = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
Outlook.Items oItems = Ocalender.Items ;
int iNumContacts = oItems.Count;
Outlook.AppointmentItem c = (Outlook.AppointmentItem)(oItems[1]);

string sub = c.Subject;
string body = c.Body;

If someone need more description about this,kindly ask

A: 

Hi, thanks for reply i just wan to show details from default address book of outlook 2003

Thanks Pratik Asthana

A: 

The easiest way would be to just grab them from the contact item. Retrieve the contacts by searching for them via Find (MSDN):

string filter =
      "[EMail1Address] = " + address + 
  " OR [EMail2Address] = " + address + 
  " OR [EMail3Address] = " + address;
ContactItem ci = oNS.GetDefaultFolder(olFolderContacts).Items.Find(filter);

You can get the addresses from the recipient items stored with the appointment.

Georg Fritzsche
A: 

Hi, Thanks for Reply

I want those contact details who are in appointment,I am able to get the Name of attendee with following code.But i am not able to get his corresponding Mobile/Telephone Number

[Code] int i = 0; int j=0; Outlook.Recipients rec; Outlook.Application oApp = new Outlook.Application(); Outlook.NameSpace oNS = oApp.GetNamespace("MAPI"); oNS.Logon(Type.Missing, Type.Missing, false, true); Outlook.MAPIFolder Ocalender = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar ); Outlook.Items oItems = Ocalender.Items; int iNumContacts = oItems.Count;

        DataSet ds_temp = new DataSet();
        DataTable dtable_temp = new DataTable("Temp_Table");

        dtable_temp.Columns.Add("Sr. No.");
        dtable_temp.Columns.Add("Name");
        dtable_temp.Columns.Add("Phone");
        dtable_temp.Columns.Add("Check", typeof(bool));

        DataRow dr_temp;

        if (iNumContacts != 0)
        {
            for (i = 1; i <= iNumContacts; i++)
            {
                dr_temp = dtable_temp.NewRow();
                Outlook.AppointmentItem c = (Outlook.AppointmentItem)(oItems[i]);
                rec = c.Recipients ;

                for (j = 1; j <= rec.Count; j++)
                {
                    string re = rec[j].AddressEntry.Name ;
                }
            }
        }

[/Code]

Can u help me

Thanks in Advance

Pratik Asthana