G
Guest
Hello. I am writing a C# program that uses CDO 1.21 to access the outlook addressbook as a contact management system
The following code gives me the correct dialog box, but the "Show Names from the:" drop down list box is empty
I opened the correct default profile (i have only 1 profile) and I should see Global Address List (from the exchange server), and at least 1 Contact folder
try
Object[] argsAddressBook = new Object[9]
argsAddressBook[0] = Missing.Value
argsAddressBook[1] = Missing.Value
argsAddressBook[2] = Missing.Value
argsAddressBook[3] = Missing.Value
argsAddressBook[4] = Missing.Value
argsAddressBook[5] = Missing.Value
argsAddressBook[6] = Missing.Value
argsAddressBook[7] = Missing.Value
argsAddressBook[8] = Missing.Value
MAPI.Session oSession = new MAPI.Session()
argsLogon[0] = Missing.Value; // ProfileNam
argsLogon[1] = Missing.Value; // ProfilePasswor
argsLogon[2] = Missing.Value; // ShowDialo
argsLogon[3] = Missing.Value; // NewSessio
argsLogon[4] = Missing.Value; // ParentWindo
argsLogon[5] = Missing.Value; // NoMai
argsLogon[6] = Missing.Value; // ProfileInf
oSession.GetType().InvokeMember("Logon", BindingFlags.InvokeMethod, null, oSession, argsLogon)
MAPI.Recipients oRecipients
(MAPI.Recipients)oSession.GetType().InvokeMember("AddressBook", BindingFlags.Default |BindingFlags.GetProperty, null, oSession, argsAddressBook)
The last statement brings up the correct dialog box, but it doesnt let me choose any address lists from the drop down list box
Other techniques, such as Outlook Object Model can find my folders, but its too slow so I want to do it with CDO
I know CDO 1.21 is "unsupported" with .net and c#, but is there anything obvious I have forgotten or any other way to access the AddressBooks
If I use Session.GetFolder with the correct EntryID, I can get my Contacts folder and other folders directly, and I guess I could make my own dialog box and iterate through the addresses with Folder.Messages, but I would prefer to use the builtin GUI
Thanks a lot for any tips
Kurt
The following code gives me the correct dialog box, but the "Show Names from the:" drop down list box is empty
I opened the correct default profile (i have only 1 profile) and I should see Global Address List (from the exchange server), and at least 1 Contact folder
try
Object[] argsAddressBook = new Object[9]
argsAddressBook[0] = Missing.Value
argsAddressBook[1] = Missing.Value
argsAddressBook[2] = Missing.Value
argsAddressBook[3] = Missing.Value
argsAddressBook[4] = Missing.Value
argsAddressBook[5] = Missing.Value
argsAddressBook[6] = Missing.Value
argsAddressBook[7] = Missing.Value
argsAddressBook[8] = Missing.Value
MAPI.Session oSession = new MAPI.Session()
argsLogon[0] = Missing.Value; // ProfileNam
argsLogon[1] = Missing.Value; // ProfilePasswor
argsLogon[2] = Missing.Value; // ShowDialo
argsLogon[3] = Missing.Value; // NewSessio
argsLogon[4] = Missing.Value; // ParentWindo
argsLogon[5] = Missing.Value; // NoMai
argsLogon[6] = Missing.Value; // ProfileInf
oSession.GetType().InvokeMember("Logon", BindingFlags.InvokeMethod, null, oSession, argsLogon)
MAPI.Recipients oRecipients
(MAPI.Recipients)oSession.GetType().InvokeMember("AddressBook", BindingFlags.Default |BindingFlags.GetProperty, null, oSession, argsAddressBook)
The last statement brings up the correct dialog box, but it doesnt let me choose any address lists from the drop down list box
Other techniques, such as Outlook Object Model can find my folders, but its too slow so I want to do it with CDO
I know CDO 1.21 is "unsupported" with .net and c#, but is there anything obvious I have forgotten or any other way to access the AddressBooks
If I use Session.GetFolder with the correct EntryID, I can get my Contacts folder and other folders directly, and I guess I could make my own dialog box and iterate through the addresses with Folder.Messages, but I would prefer to use the builtin GUI
Thanks a lot for any tips
Kurt