Scheduled Task for Outllok 2007...

  • Thread starter Thread starter ShrimpBoy
  • Start date Start date
S

ShrimpBoy

Hi!

I have a generic user on our AD that have a mailbox and this user receive an
email every morning...

I created an application with Microsoft Office 2007 PIA and Visual Studio
2005.



The application get the email from today, parse it and create an excel file
with it..

I first received a warning but I disabled the warning message in the trust
center of Outlook 2007 (Allow, Deny, Help)...

Now I have no warning and when logged as my generic user everything works...

I created a scheduled task on the server to run my application as the
generic user but it doesn't work... it keeps running but I don't see any
thing done...

Outlook.exe process consume 0% of the CPU...

How can I make this task works?

Thanks!
 
Hi!

Sorry to disappoint you but I found a solution...

I had to add some code...

Microsoft.Office.Interop.Outlook.ApplicationClass outLook = new
Microsoft.Office.Interop.Outlook.ApplicationClass();

Microsoft.Office.Interop.Outlook.NameSpace nameSpace = outLook.Session;

//This makes it work, I need a session since no Outlook session are open.
The last true is the new session parameter
nameSpace.Logon(Type.Missing, Type.Missing, false, true);

Here is the link to the MSDN documentation...

http://msdn.microsoft.com/en-us/library/bb219914.aspx

Thanks for your effort but you miss the answer...

ShrimpBoy
 
Just because you can call Namespace.Logon doesn't make your approach
supported. It is not guaranteed to work reliably, for reasons including those
in the article I suggested. If you want a reliable solution, you should take
a different approach.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
Back
Top