Hi
Thanks Dmitry.
But How to create an instance for addresslists, addresslist,
addressentries & addressentry in .net? i dont know how since cannot
create the object straight by using new. When i tried new operator
found addressListInterface and addresslistClass. How shud i????
then tried by creating object and then cast to object type(as u
suggested to someone in a group). but i cannot move thru items as it
is not a collection, just an object.
Microsoft.Office.Interop.Outlook.NameSpace oNs;
oNs = Connect.oApplication.GetNamespace("MAPI");
Object rals;
Object ral;
Object raes;
Object rae;
rals = oNs.AddressLists;
MessageBox.Show(((Redemption.AddressLists)rals).Count.ToString());
for(int intI=0;intI<((Redemption.AddressLists)rals).Count;i++)
{
//here is the problem, since rals is an object, cannot access
ral = rals(intI);
raes = ((Redemption.AddressList)ral).AddressEntries;
for(int intJ=1;intJ<((Redemption.AddressEntries)raes).Count;intJ++)
{
//here is the problem, since raes is an object, cannot access
rae = raes(intJ);
MessageBox.Show(((Redemption.AddressEntry)rae).Address );
//((Redemption.AddressEntry)rae).Address
}
}
Or shud i go thru some other way like
rals = Activator.CreateComInstanceFrom("Interop.Redemption.dll","Redemption.AddressListsClass");
Even so how to access the properties and methods????
My main intention is to get the id for the name i give, by accessing
outlook contacts.
Pls let me know
Thx
Anushya
> You are casting Outlook.AddressLists object returned by
> Namespace.AddressLIsts to Redemption.AddressLists, that is bound to fail.
[quoted text clipped - 27 lines]
> > Thanks
> > Anushya
Dmitry Streblechenko \(MVP\) - 21 Feb 2004 07:13 GMT
Simply use new to create an instance of the Redemption.AddressLists object.
Or something like
Type t = Type.GetTypeFromProgID("Redemption.AddressLists");
Redemption.AddressLists rals = (Redemption.AddressLists)
Activator.CreateInstance(t);
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
> Hi
> Thanks Dmitry.
[quoted text clipped - 32 lines]
>
> rals =
Activator.CreateComInstanceFrom("Interop.Redemption.dll","Redemption.Address
ListsClass");
> Even so how to access the properties and methods????
> My main intention is to get the id for the name i give, by accessing
[quoted text clipped - 34 lines]
> > > Thanks
> > > Anushya