![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
Hi,
I was hoping someone could give me a hand. I wrote a program to automatically read email from outlook. The application successfully read email from outlook when outlook is opened. But when I shut down outlook, the program can no longer read email. Or it other words it doesn't have access to exchange server. Other notes, I have cached mode turn off for this specific email account because I always want to be able to read the latest email. Cache mode does not reliably guaranteed that I will get the latest mail when trying to retrieve mail programmatically. So this is the error which comes back when I try to access email when Outlook is not running. Does any one know if it is even possible to read email when an instance of outlook is not running (the email account having cache mode turn off)? If it is possible, do you know how to go about it? Here is the code which I use to retrieve email from outlook. It's in C# but i'm sure it's very similar in VB. // ################################################# using Microsoft.Office.Interop.Outlook; .. .. .. Application myOutLook = new Application(); myOutlook.Session.Logon(userName, password, false, false); // ################################################# this code works perfectly fine when I have outlook open. But when I shut down outlook, this is the error which I receive. "The server is not available. Contact your administrator if the condition persists." And if you are thinking that exchange might be down, then nope. Exchange is available. So if any one can lend a hand, I would greatly appreciate it. Thanks in advance. |
#2
|
|||
|
|||
![]()
As far as I know you have to Outlook running to access folders, etc.
This code will check for an existing instance of Outlook, and if it isn't open, it starts one. GetObject will return the running instance, otherwise CreateObject will create it. The code will exit if neither is possible. Dim olApp As Object ' Dim olApp As Outlook.Application if you set a reference to Outlook object library Application.StatusBar = "Checking For Existing Copy of Outlook..." ' test for instance of Outlook, exit if not able to start one On Error Resume Next Set olApp = GetObject(, "Outlook.Application") If Err.Number 0 Then Set olApp = CreateObject("Outlook.Application") End If On Error GoTo 0 If olApp Is Nothing Then Application.StatusBar = False MsgBox "Cannot start Outlook. Please open Outlook and try again.", _ vbInformation Exit Sub End If HTH, JP On Mar 4, 5:47*pm, wrote: Hi, I was hoping someone could give me a hand. I wrote a program to automatically read email from outlook. *The application successfully read email from outlook when outlook is opened. *But when I shut down outlook, the program can no longer read email. *Or it other words it doesn't have access to exchange server. Other notes, I have cached mode turn off for this specific email account because I always want to be able to read the latest email. Cache mode does not reliably guaranteed that I will get the latest mail when trying to retrieve mail programmatically. So this is the error which comes back when I try to access email when Outlook is not running. Does any one know if it is even possible to read email when an instance of outlook is not running (the email account having cache mode turn off)? *If it is possible, do you know how to go about it? Here is the code which I use to retrieve email from outlook. *It's in C# but i'm sure it's very similar in VB. // ################################################# using Microsoft.Office.Interop.Outlook; . . . Application myOutLook = new Application(); myOutlook.Session.Logon(userName, password, false, false); // ################################################# this code works perfectly fine when I have outlook open. *But when I shut down outlook, this is the error which I receive. "The server is not available. *Contact your administrator if the condition persists." And if you are thinking that exchange might be down, then nope. Exchange is available. So if any one can lend a hand, I would greatly appreciate it. *Thanks in advance. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook 2003 – Email dynamic behavior in Read Mode | alex | Outlook - General Queries | 0 | October 4th 07 01:34 PM |
Received Email White Font Can't change and can't read - Outlook 20 | william | Outlook - General Queries | 1 | March 28th 07 02:53 AM |
Stopping Outlook sending Email Not Read messages | [email protected] | Outlook - General Queries | 0 | October 5th 06 10:03 PM |
Can't read email on Outlook Mobile on WM5. How to reinstall? | [email protected] | Outlook - General Queries | 1 | September 5th 06 12:02 PM |
I want to set up outlook 2003 to read my msn & hotmail email. | Mike M | Outlook - Installation | 0 | January 17th 06 04:46 PM |