Welcome! Log In Create A New Profile

Advanced

Reading Outlook Exchange emails in a service

Posted by CMBthierry 
Reading Outlook Exchange emails in a service
July 17, 2019 02:08PM
Hi everybody,
I ‘trying to open an emailsession for Outlook Exchange in a service with EmailStartOutlookSession(“Outlook”)
but always get the error message :

Unable to open the session with the 'Outlook' profile
Error code: 520045
Level: non-fatal error
System error code: -2147221246
System error message:
Invalid window handle



The 'Outlook' profile exists and in runtime my code works.
The service is connected to the right user and has administrator rights.
Does anybody has experience with reading outlook mails in a service ?
stefan.kern
Re: Reading Outlook Exchange emails in a service
July 19, 2019 11:46AM
Hi,

I am not sure, wheather I am correct or not, but:
A Service can not have a Gui and can not interact with a Gui and according to the help a Service can not call locking functions.

So I am quite sure, that EmailStartOutlookSession() is a locking function or tries to interact with the gui.

Your error message Claims an invalid window handle, which indicates that some Gui operations are started.

Regards



Stefan.
Re: Reading Outlook Exchange emails in a service
July 19, 2019 10:36PM
Agree with Stefan, however, you could try accessing the folders by way of the Outlook Interop API.

https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.interop.outlook?view=outlook-pia

Georgio
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: