http://www.dotnet247.com/247reference/msgs/57/289991.aspx
Another developer experienced the same exception as your report.
Here you go. There are some confg settings that are required.
1: In your machine.config processModel section change userName from
"machine" to "system".
2: In Local Security Settings, Local Policies, User Rights Assignments...
Add the ASPNET user to "Act as part of the operating system"
3: In the web.config add the following where OutlookUser is an Authenticated
Outlook User
<system.web>
<identity impersonate="true" userName="domain\OutlookUser"
password="******" />
//implementation
NetForms.OutlookMail oMail = new NetForms.OutlookMail();
oMail.sendEMail("John Doe", "Hello", "Hello World");
//C# unit
namespace NetForms {
using System;
using System.Collections;
using Outlook;
public class OutlookMail{
private Outlook.Application oApp;
private Outlook._NameSpace oNameSpace;
private Outlook.MAPIFolder oSentMailFolder;
private Outlook.AddressLists oAddressLists;
public OutlookMail()
{
//Return a reference to the MAPI layer
oApp = new Outlook.Application();
oNameSpace= oApp.GetNamespace("MAPI");
/***********************************************************************
* Logs on the user
* Profile: Set to null if using the currently logged on user, or
set
* to an empty string ("") if you wish to use the default
Outlook Profile.
* Password: Set to null if using the currently logged on user, or
set
* to an empty string ("") if you wish to use the default
Outlook Profile
* password.
* ShowDialog: Set to True to display the Outlook Profile dialog
box.
* NewSession: Set to True to start a new session. Set to False to
* use the current session.
***********************************************************************/
oNameSpace.Logon(null,null,false,true); //DO NOT EVER HAVE SHOWDIALOG
AS TRUE
//gets defaultfolder for my Outlook Outbox
oSentMailFolder =
oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderSentMail);
oAddressLists = oNameSpace.AddressLists;
if(oAddressLists.Count > 0){
ArrayList a = new ArrayList();
for (int i = 1; i <= oAddressLists.Count; i++){
a.Add(oAddressLists.Item(i).Name);
}
}
}
public void sendEMail(string toValue, string subjectValue, string
bodyValue)
{
//creates a new MailItem object
Outlook._MailItem oMailItem =
(Outlook._MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
oMailItem.To = toValue;
oMailItem.Subject = subjectValue;
oMailItem.Body = bodyValue;
oMailItem.SaveSentMessageFolder = oSentMailFolder;
oMailItem.Send();
}
}
}
Post by Hevel, Shawnhttp://msdn2.microsoft.com/en-us/library/aa168022(office.11).aspx
System.Runtime.InteropServices.COMException (0x80080005): Server execution failed.
I believe it's because I'm running under ASPNET and Outlook doesn't like that.
Has anyone received the above error and could you explain in detail how
you got around this issue?
Thanks,
Our vision is to develop an environment that will stimulate the
transformation of data and information into knowledge and wisdom. Our
mission is to stay focused on the plans and goals with a sense of urgency
necessary to improve the company's profitability and market share.
Shawn Hevel, API, AIT
LeadProgrammer Analyst
Information Technology Department
South Carolina Farm Bureau Insurance Companies
Phone: (803) 936-4331
Fax: (803) 936-4629
-----Original Message-----
Sent: Friday, July 20, 2007 10:04 AM
Subject: Re: [DOTNET-WEB] Outlook 2003 Question & integration with DotNet 1.1
http://www.outlookcode.com/article.aspx?ID=43
---
Patrick Steele
http://weblogs.asp.net/psteele
-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
Sent: Thursday, July 19, 2007 7:43 AM
Subject: [DOTNET-WEB] Outlook 2003 Question & integration with DotNet 1.1
I have a DotNet 1.1 question.
I'd like to display a list of email address from our companies Information
Technology group alias. Is there a way to integrate Outlook 2003 into
DotNet 1.1 and retrieve this information so I can populate a drop down list?
This is similar to what Outlook does when you click on the 'To' icon and you
have the choice of picking a 'To', 'CC', 'BCC' address to send to.
===================================
This list is hosted by DevelopMentor(r) http://www.develop.com
View archives and manage your subscription(s) at
http://discuss.develop.com
===================================
This list is hosted by DevelopMentor(r) http://www.develop.com
View archives and manage your subscription(s) at
http://discuss.develop.com
===================================
This list is hosted by DevelopMentor® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com