P
Peter
Hello,
Thanks for reviewing my question. I have followed the Microsoft Knowledge Base Article - 313802 and get exception when trying to access the first contact in the Outlook's contact list. I also created a VB program and copied the sample from the article and got the same exception. The following is a sample of my code:
Outlook.Application oApp = new Outlook.Application();
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
oNS.Logon(Missing.Value, Missing.Value, false, true);
Outlook.MAPIFolder cContacts = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
Outlook.Items oItems = cContacts.Items;
Outlook.ContactItem oCt = (Outlook.ContactItem)oItems.GetFirst(); // EXCEPTION IS THROWN
It says it was a bad cast. Any ideas?
Many Thanks
Peter
Thanks for reviewing my question. I have followed the Microsoft Knowledge Base Article - 313802 and get exception when trying to access the first contact in the Outlook's contact list. I also created a VB program and copied the sample from the article and got the same exception. The following is a sample of my code:
Outlook.Application oApp = new Outlook.Application();
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
oNS.Logon(Missing.Value, Missing.Value, false, true);
Outlook.MAPIFolder cContacts = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
Outlook.Items oItems = cContacts.Items;
Outlook.ContactItem oCt = (Outlook.ContactItem)oItems.GetFirst(); // EXCEPTION IS THROWN
It says it was a bad cast. Any ideas?
Many Thanks
Peter