-
December 10th, 2008, 07:44 PM
#1
Outlook and logon
in a code i mtrying to logon to outlook and get al te contacts details.
Code:
Outlook.Application oApp = new Outlook.Application();
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
oNS.Logon("", null, null, null);
Outlook.MAPIFolder oContacts = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
Outlook.Items oItems = (Outlook.Items)oContacts.Items;
int i = oItems.Count;
if (i > 0)
{
Outlook.ContactItem oCt = (Outlook.ContactItem)oItems.GetFirst();
while (i > 0)
{
string temp = oCt.FullName.ToString();
oCt = (Outlook.ContactItem)oItems.GetNext();
string s = temp;
i--;
}
}
oNS.Logoff();
for some reason i am getting zero counts for i and that may have to do with the logon statement.
I have also done it with providing the userid and password and no luck so far , so my question is how do you know if you are actullay logged on or not ?
should not what i have codeed in logon statement pop up a dialog asking me to logon?
-
December 11th, 2008, 04:05 PM
#2
Re: Outlook and logon
I think you are going to need at least a profile name. I use this in some of my .net code.
Code:
ONS.Logon("MyProfileName", "MyPassword", true, true);
This is for a windows active directory domain and outlook 2007 connected to MS Exchange.
I am not exactly sure but you will probably end up with several message boxes asking if you want to allow access to your contacts.
Good luck.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|