Following is the piece of code i got from this forum itself but stil i am not able to get the full details of recepients like location,office number.
plz help me to access that information..
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using MAPI;
using System.Reflection;
using Outlook = Microsoft.Office.Interop.Outlook;
namespace Sample1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Search_Click(object sender, EventArgs e)
{
try
{
MAPI.SessionClass oSession = new MAPI.SessionClass();
oSession.Logon("Gnana",
System.Reflection.Missing.Value, true, true,
System.Reflection.Missing.Value, false, System.Reflection.Missing.Value);
MAPI.Recipients oRecipients = null;
MAPI.Recipient oRecipient = null;
MAPI.AddressEntry oAddressEntry = null;
// Display dialog box to select recipient(s)
// Watch the wrapping on this next line, everything needs to be on one line.
oRecipients = (MAPI.Recipients)oSession.AddressBook(System.Refle ction.Missing.Value,"Select Name", true, true, -1, "", "", "", 0);
for(int i = 1; i <= (int)oRecipients.Count; i++)
{
// Do what you need with Recipient, or AddressEntry
oRecipient = (MAPI.Recipient)oRecipients.get_Item(i);
// MAPI.AddressList oadd=(MAPI.AddressList)oRecipients.
oAddressEntry = (MAPI.AddressEntry)oRecipient.AddressEntry;
MessageBox.Show(oRecipient.Address.ToString());
MessageBox.Show(oAddressEntry.Name.ToString());
}
oSession.Logoff();
}
catch (Exception et)
{
MessageBox.Show(""+et);
}
}
}
}