By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,306 Members | 1,621 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,306 IT Pros & Developers. It's quick & easy.

Outlook automation gives COMException Server execution failed

P: n/a
I wrote the following code:
oApp = new Outlook.Application();
oApp = new Outlook.Application();
oNameSpace= oApp.GetNamespace("MAPI");
oNameSpace.Logon(null,null,true,true);
//gets defaultfolder for my Outlook Outbox
oOutboxFolder =
oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolde rs.olFolderOutbox);

But it won't work and it is giving me the following error:
Server Error in '/SendEmail' Application
--------------------------------------------------------------------------------

Server execution failed
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Server
execution failed

Source Error:
Line 24: {
Line 25: //Return a reference to the MAPI layer
Line 26: oApp = new Outlook.Application();
Line 27: oApp = new Outlook.Application();
Line 28: oNameSpace= oApp.GetNamespace("MAPI");
Source File: c:\inetpub\wwwroot\sendemail\outlookmail.aspx.cs Line: 26

Stack Trace:
[COMException (0x80080005): Server execution failed]
SendEmail.OutlookMail..ctor() in
c:\inetpub\wwwroot\sendemail\outlookmail.aspx.cs:2 6
ASP.OutlookMail_aspx..ctor() in
c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Tempo rary ASP.NET
Files\sendemail\c53a1a47\a51e0147\tiscp1-q.0.cs:0

[TargetInvocationException: Exception has been thrown by the target of an
invocation.]
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly) +0
System.Activator.CreateInstance(Type type, Boolean nonPublic) +66
System.Web.UI.TemplateControlParser.GetCompiledIns tance(String
virtualPath, String inputFile, HttpContext context) +164

[HttpException (0x80004005): Failed to create page of type
'ASP.OutlookMail_aspx'.]
System.Web.UI.TemplateControlParser.GetCompiledIns tance(String
virtualPath, String inputFile, HttpContext context) +337
System.Web.UI.PageParser.GetCompiledPageInstanceIn ternal(String
virtualPath, String inputFile, HttpContext context) +43
System.Web.UI.PageHandlerFactory.GetHandler(HttpCo ntext context, String
requestType, String url, String path) +44
System.Web.HttpApplication.MapHttpHandler(HttpCont ext context, String
requestType, String path, String pathTranslated, Boolean useAppConfig) +698

System.Web.MapHandlerExecutionStep.System.Web.Http Application+IExecutionStep.Execute() +95
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously) +173


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.985; ASP.NET
Version:1.1.4322.968

Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Here is a nice little post
http://groups.google.com/groups?hl=e...p04%26rnum%3D4
(watch for wraps) that shows how to setup so that you can use outlook in
ASP.NET

That might help.
"Bassel Tabbara" <Bassel Ta*****@discussions.microsoft.com> wrote in message
news:B4**********************************@microsof t.com...
I wrote the following code:
oApp = new Outlook.Application();
oApp = new Outlook.Application();
oNameSpace= oApp.GetNamespace("MAPI");
oNameSpace.Logon(null,null,true,true);
//gets defaultfolder for my Outlook Outbox
oOutboxFolder =
oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolde rs.olFolderOutbox);

But it won't work and it is giving me the following error:
Server Error in '/SendEmail' Application.
-------------------------------------------------------------------------- ------
Server execution failed
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Server
execution failed

Source Error:
Line 24: {
Line 25: //Return a reference to the MAPI layer
Line 26: oApp = new Outlook.Application();
Line 27: oApp = new Outlook.Application();
Line 28: oNameSpace= oApp.GetNamespace("MAPI");
Source File: c:\inetpub\wwwroot\sendemail\outlookmail.aspx.cs Line: 26

Stack Trace:
[COMException (0x80080005): Server execution failed]
SendEmail.OutlookMail..ctor() in
c:\inetpub\wwwroot\sendemail\outlookmail.aspx.cs:2 6
ASP.OutlookMail_aspx..ctor() in
c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Tempo rary ASP.NET
Files\sendemail\c53a1a47\a51e0147\tiscp1-q.0.cs:0

[TargetInvocationException: Exception has been thrown by the target of an
invocation.]
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly) +0
System.Activator.CreateInstance(Type type, Boolean nonPublic) +66
System.Web.UI.TemplateControlParser.GetCompiledIns tance(String
virtualPath, String inputFile, HttpContext context) +164

[HttpException (0x80004005): Failed to create page of type
'ASP.OutlookMail_aspx'.]
System.Web.UI.TemplateControlParser.GetCompiledIns tance(String
virtualPath, String inputFile, HttpContext context) +337
System.Web.UI.PageParser.GetCompiledPageInstanceIn ternal(String
virtualPath, String inputFile, HttpContext context) +43
System.Web.UI.PageHandlerFactory.GetHandler(HttpCo ntext context, String
requestType, String url, String path) +44
System.Web.HttpApplication.MapHttpHandler(HttpCont ext context, String
requestType, String path, String pathTranslated, Boolean useAppConfig) +698
System.Web.MapHandlerExecutionStep.System.Web.Http Application+IExecutionStep
..Execute() +95 System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously) +173


-------------------------------------------------------------------------- ------ Version Information: Microsoft .NET Framework Version:1.1.4322.985; ASP.NET Version:1.1.4322.968

Nov 18 '05 #2

P: n/a

Hi Girish,
Thanks for the tip. I was thinking in these terms but I don't like the fact
to use the System account. Can I use a different account who has enough
priviliges to access outlook?

Thanks,

Bassel

"Girish bharadwaj" wrote:
Here is a nice little post
http://groups.google.com/groups?hl=e...p04%26rnum%3D4
(watch for wraps) that shows how to setup so that you can use outlook in
ASP.NET

That might help.
"Bassel Tabbara" <Bassel Ta*****@discussions.microsoft.com> wrote in message
news:B4**********************************@microsof t.com...
I wrote the following code:
oApp = new Outlook.Application();
oApp = new Outlook.Application();
oNameSpace= oApp.GetNamespace("MAPI");
oNameSpace.Logon(null,null,true,true);
//gets defaultfolder for my Outlook Outbox
oOutboxFolder =
oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolde rs.olFolderOutbox);

But it won't work and it is giving me the following error:
Server Error in '/SendEmail' Application.
--------------------------------------------------------------------------

------

Server execution failed
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information

about
the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Server
execution failed

Source Error:
Line 24: {
Line 25: //Return a reference to the MAPI layer
Line 26: oApp = new Outlook.Application();
Line 27: oApp = new Outlook.Application();
Line 28: oNameSpace= oApp.GetNamespace("MAPI");
Source File: c:\inetpub\wwwroot\sendemail\outlookmail.aspx.cs Line: 26

Stack Trace:
[COMException (0x80080005): Server execution failed]
SendEmail.OutlookMail..ctor() in
c:\inetpub\wwwroot\sendemail\outlookmail.aspx.cs:2 6
ASP.OutlookMail_aspx..ctor() in
c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Tempo rary ASP.NET
Files\sendemail\c53a1a47\a51e0147\tiscp1-q.0.cs:0

[TargetInvocationException: Exception has been thrown by the target of an
invocation.]
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly) +0
System.Activator.CreateInstance(Type type, Boolean nonPublic) +66
System.Web.UI.TemplateControlParser.GetCompiledIns tance(String
virtualPath, String inputFile, HttpContext context) +164

[HttpException (0x80004005): Failed to create page of type
'ASP.OutlookMail_aspx'.]
System.Web.UI.TemplateControlParser.GetCompiledIns tance(String
virtualPath, String inputFile, HttpContext context) +337
System.Web.UI.PageParser.GetCompiledPageInstanceIn ternal(String
virtualPath, String inputFile, HttpContext context) +43
System.Web.UI.PageHandlerFactory.GetHandler(HttpCo ntext context, String
requestType, String url, String path) +44
System.Web.HttpApplication.MapHttpHandler(HttpCont ext context, String
requestType, String path, String pathTranslated, Boolean useAppConfig)

+698

System.Web.MapHandlerExecutionStep.System.Web.Http Application+IExecutionStep
..Execute() +95
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously) +173


--------------------------------------------------------------------------

------
Version Information: Microsoft .NET Framework Version:1.1.4322.985;

ASP.NET
Version:1.1.4322.968


Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.