c# - Open Outlook with same credentials as running application -


i'm writing program needs open microsoft outlook , create mail item user when click on button. however, when so, following error:

retrieving com class factory component clsid {0006f03a-0000-0000-c000- 000000000046} failed due following error: 80080005 server execution failed (exception hresult: 0x80080005 (co_e_server_exec_failure)). after researching error found out program , ms outlook must both run administrator or normal privilege level.

so here's question... how open ms outlook through c# code using same privilege level current running program. need current privilege level, open outlook privilege level. i've had no luck in research far. appreciated!

here's code (currently) opening ms outlook , how use it:

application outlookapp = new application();  mailitem mailitem = outlookapp.createitem(olitemtype.olmailitem); mailitem.subject = "blah"; mailitem.htmlbody= @"various html stuff";  foreach (string documentpath in this.documentpaths) {     mailitem.attachments.add(documentpath, 1, 1, documentpath); }  mailitem.display(true); 

i using microsoft.office.interop.outlook. if outlook running administrator. don't error.

please suggest.

outlook singleton, make sure running on same trust level app, app must 1 starts it.

  1. you can try kill outlook first (not nice , user won't appreciate it) before restarting app.

  2. you can use extended mapi (c++ or delphi) or redemption (it wraps extended mapi , can used language) - mapi loaded in-proc, work if outlook running. not able display items: outlook.exe 1 ends displaying messages if use mapi, started.

why app , outlook end running in different security contexts?


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -