attempting to use a button to open a new outlook email - (getting error)

I am getting an error when I try to open an outlook email from a imagebutton click event.  We are using Outlook 2007 (if it matters)...  All I want to do is click a button, and have it open an email that will have the subject and body (text/hyperlinks) filled in.   I was doing a basic mailto: from a hyperlink earlier, but it looks like when it opened outlook, it wouldnt resolve the html tags... so I went back to the below method

Any help would be awesome... and thanks!

My code is fairly simple - I posted the relevant code below.....  (the error is down a bit further)

protected void ImageButton2_Click(object sender, ImageClickEventArgs e)

  

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Net.Mail;
using Outlook = Microsoft.Office.Interop.Outlook;
using Microsoft.Office.Core;
..
..
..
..
protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect="mailto:larry,dan?cc=mike&bcc=sue&subject=test&body=type+your&body=message+here";

            Microsoft.Office.Interop.Outlook.ApplicationClass app = new Microsoft.Office.Interop.Outlook.ApplicationClass();
            Outlook.MailItem mail = (Outlook.MailItem)app.CreateItem(Outlook.OlItemType.olMailItem);

            mail.To = "to.email";
            mail.Subject = "header text";
            mail.Body = "body text";

        }
 

The error is as follows:

Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80070005.

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.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80070005.

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

0
bjsusol
5/4/2009 6:47:04 PM
asp.net.integration 1945 articles. 0 followers. Follow

1 Replies
871 Views

Similar Articles

[PageSpeed] 31
Get it on Google Play
Get it on Apple App Store

 Hi,

Kindly check...

1} Have Got Installed Outllok On Machice...

 2} Y There Redirecting of page...

3} Try Give Full Control To IIS User..

 

http://support.microsoft.com/kb/317012

an put<identity impersonate="true"/>,
in web.config file

Code I have used  for  Outlook2003

Add - refernce --> com tab-->Microsoft outlook 11 (somenthing )

Then write the follwing code

/****************Code What i have used Without use mailto***************/


   private void CreateMailItem()
        {
            Microsoft.Office.Interop.Outlook.Application outlookApp = new Microsoft.Office.Interop.Outlook.ApplicationClass();

            Microsoft.Office.Interop.Outlook.MailItem mailItem = (Microsoft.Office.Interop.Outlook.MailItem)
            outlookApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
            mailItem.Subject = "This is the subject";
            mailItem.To = "<email id>";
            mailItem.Body = "This mail is Send Using Outlook";
            mailItem.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceNormal;
            mailItem.Display(false);
        }

/***********************************/




Hope it helps


Thanks
Avinash Tiwari

Remember to click “Mark as Answer” on the post, if it helps you.
0
qwe123kids
5/5/2009 5:43:51 AM
Reply:

Similar Artilces:

1- Send Feedback button: Open NEW tab, please; NO in the tab in use. 2- New tab open next to actual tab in use (like Chrome), NOT at the end of all tabs, please.
Name: RiveraValdez Email: riveravaldezatysinembargodotcom Product: Firefox Summary: 1- Send Feedback button: Open NEW tab, please; NO in the tab in use. 2- New tab open next to actual tab in use (like Chrome), NOT at the end of all tabs, please. Comments: That ;) Thanks! Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-AR; rv:1.9.1b3) Gecko/20090305 Firefox/3.0.3;MEGAUPLOAD 1.0 (.NET CLR 3.5.30729) From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (n...

open the open file dialog box on button click using vb.net
 Using vb.net code,I want to open the open file dialog box on button click  and then to select a file  and  selected file has to be shown in a text box.On clicking another button, file name should get stored in database.Anyone who has solution or suggestion, pls reply. You need to drop a FileUpload control on your page. It does much of the job automatically. Here is the Aap.Net tags:  <div> <asp:fileupload ID="MyFile" runat="server"></asp:fileupload> <br /> <asp:TextBox ID="txtFileName" runat...

Open Outlook using a button
Hi there, I am trying to open an outlook calendar from a sharepoint site....Outlook is installed on every machine, so I dont have to worry about error handling but I dont have any ideas on how to achieve this.Has anyone done this? if so please would you be able to show me how I can achieve this.       Thank you!   protected void btnAdd_Clicked(object sender, EventArgs e) { Process outLook = new Process(); outLook.StartInfo.FileName = "msimn.exe"; outLook.Start();   }Don't forget to click "Mark as Answer" on the post that helpe...

Send New Email Opens Another New Email
I just upgraded to Groupwise 8.1 on the server and about 5 clients. About 115 other clients are running 7.0, 7.1 or 7.2 clients. After the install, whenever anyone creates a new email message and clicks the send button, another window pops up. The window is another blank email as if you are sending another new email. This also happens on a reply, so if you sit down and do 5-6 replies at a time, you get anothe 5-6 blank email windows. My users and myself find this feature annoying and would like to turn it off. Some users think the first email did not send and actually re-typ...

how to open new window using Button
i made a control panel for the "user", and from that there is a button "edit", if the user click the button "edit",it will directly respond to the another page where the user can edit the their profile..and in the "edit profile" page there is a button "save",and if the user click the button to save some changes,the user will go back to the "settings or control panel of a user"....i just want to know how will i code it in codefile aspx.vb? regards jong On the code behind: YourBtn.Attributes.Add("onclick","window.open('foo.aspx');return false;"); EricPascarello.com | Twitter epascar...

opening a new window with the use of buttons
button.attribute.add("onclick","window.open()") i am encountering a problem whenever i try to open a new window using a buttonit doesn't work whenever i press the button for the first time after the page loadedit works fine afterwards thoughhow can i work around this? thanks Where do you add this attribute?  It sounds like it is being added somewhere that is only called after a postback occurs.  Thus you issue a postback, the attribute gets added, and then you have to click the button again to use it.Protected button As ButtonPrivate Sub Page_Load(ByVal sender As System.Object,...

How do I open a new window using VB.NET???
I am trying to display an image in a new window using an image button. When the user clicks on the image button, it fires the onclick event which calls my procedure. I don't know how I'm suppose to handle the event to open up the new window, to show the aspx page containing the image. I don't want to use Javascript because I am not familiar with that. Please help.... I'm afraid you will have to use JavaScript (as far as I know) - because your VB.NET/ASP.NET code sits on the server, and you want to do something on the client. Take a look at http://www.developerfusion.com/show...

How do I open a new window using a button and url?
Sorry if this is a faq. I have a button on a form. When I click it i want a new window to appear. I also want to pass some values on the url to this new window so it can use them. The values are actually from the first windows url, so in a sense I want to pass on certain values - not all of them, which are contained in the firs windows url to the 'popup window'. I tried doing something like this in teh Page_Load (in code-behind .cs file) string script = string.Format(                      &nbs...

Sending email with Outlook using VB.net
Hi I develop an application in Vb.net that email using Outlook 2003 (Primary Interop Assembly). But when I deploy to the client PC, it only WORK if that user has to be a member of Administrator group. If that user is NOT in that Administrator group then it doesn't work. I don't know the reason behind it? Please advice the reason. Thanks a lot Right click on MyComputer. click on Manage Under see the group section add that user in Administrator group. Alos install "Click yes"  programSatalaj Watch The true story of internet ||Yet another forum |||I'm big fan ...

How to open outlook express folders using VB.Net
I need to extra selected information from each email in one of my Outlook Express (outlook version 6) folders. I've found code that works but it only opens an old Outlook installation that I used when I was doing some on-site contracting. My OE folders are entirely local to my laptop. I just use it to download emails from my various internet email addresses. My windows forms project has a reference to Outlook Object Library 9.0. Here is the code I'm using:   Dim objOL As Outlook.Application Dim objNS As Outlook.NameSpace Dim objFolder As Outlook.Folders ...

Error when creating new account with email already used
Hi! When someone want to create a new account and using an email already used, instead of having a message saying that this email is already used, they have this error: Server Error in '/AspNetForums' Application. -------------------------------------------------------------------------------- Violation of UNIQUE KEY constraint 'IX_Users_UniqueEmail'. Cannot insert duplicate key in object 'Users'. Someone knows why? I've found 'IX_Users_UniqueEmail' in AspNetForums.sql and deleted it. But it changes nothing. My changements don't seems to have taken effect. Must I rebui...

open new email from outlook on client after server function
Greetings!I'm currently creating a system to email several people. These people a located in a grid. In this grid there are some checkboxes. The code below checks which box is checked and adds the email corresponding to the checkbox to a string. When the entire grid is checked, I want to popup a new outlook message with the TO-field filled in with the mailStr created on the server. The way it's done below, outlook is opend on the server, but I want to outlook to open on the clientside.    Protected Sub btnEmail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnE...

is there a way to open a new window in .net without using...
Quick question... Is there a way (command) to open a new window in your .net application without using the using the javascript call or response.redirect . The redirect will simply replace your window with the new page. So anything? Cedric NO!!! Steven BeyRecursion: see Recursion are you talking about opening a new window...like a pop up? if so...you can use the target="_blank" in your href. here is an example... Click Me I figure I've seen this question enough in the last month to build an FAQ: http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&Post...

How do I use a button to open a new window and pass a variable string?
I know how to use javascript and html href to cause a window to open, but is there a way to do it through a button command?  I would need to pass a string variable (uid) to identify the record I want the pop-up window to update, but all the code samples I've found don't show a way to pass the UID.  I can do it through a url string in a datagrid text link, but it doesn't work with button commands that I can make work. Any suggestions?  Peter VarvaisWeb DeveloperMadrona Medical Group----------------------------------------ASP.net/VB.net/SQL2K<>< Ok. From your descrip...

.NET Error! After installing the SQL spk3 and attempting to use Session...
We (like most of the world) had to install the spk3 for SQL over the weekend. This morning, when attempting to run a few ASP.NET applications that use the SQL ASPState Session we get the following error. This is happening with every single app that uses session via SQL now. "SELECT permission denied on object 'ASPStateTempApplications', database 'tempdb', owner 'dbo'. INSERT permission denied on object 'ASPStateTempApplications', database 'tempdb', owner 'dbo'. SELECT permission denied on object 'ASPStateTempApplications', database 'tempdb', owner 'dbo'." What do we need t...

Web resources about - attempting to use a button to open a new outlook email - (getting error) - asp.net.integration

Facebook Seeks Detailed Information From Users Attempting To Block Or Report Other Users
Facebook continued down the path of seeking more information when users report potentially troublesome situations, following up its dialog box ...

Texas Tribune - "I was attempting to block a bill that... - Facebook
"I was attempting to block a bill that would have harmed thousands of women across the state of Texas,” Davis said of her filibuster. “Never ...

Video of Sen. Wendy Davis Attempting to put on Back-Brace During Filibuster - YouTube
If state Sen. Wendy Davis, D-Fort Worth, is charged with one more violation of the filibuster rules, her attempt to talk Senate Bill 5 to death ...

Two arrested attempting to smuggle heroin into the UAE
Two of the 'most active and dangerous' drug smugglers in the UAE were arrested in April in possession of 55 kilograms of heroin by a team of ...

Mother of woman attempting to flee ISIL says she is now at 'great risk'
The family of notorious Islamic State fighter Khaled Sharrouf is seeking to return to Sydney, according to a report.

Attempting to procure a murder charge against AC/DC drummer Phil Rudd withdrawn
AC/DC drummer Phil Rudd's charge of attempting to procure a murder has been withdrawn.

Eight teenage girls arrested after attempting to rob woman in Shellharbour
Eight teenage girls have been arrested after a 19-year-old woman was threatened with a knife at a bus stop in the NSW Illawarra region.

Andrew Davidson arrested after attempting to have sex with drinks trolley
... was ever a reason to quit alcohol, it's this. A 25-year-old Scottish man has been arrested after making a complete fool of himself while attempting ...

Abbott, Attempting To Order Coffee, Declares The Boats Have Stopped.
Prime Minister Tony Abbott has been at the forefront of a ruckus this morning during an incident in which Mr. Abbott was attempting to order ...

Islamic State recruit lived in Sydney before attempting to travel to Syria
Asher Abid Khan was restless and living in Sydney when he began researching ways to travel to Syria or Iraq to join terror group Islamic State, ...

Resources last updated: 12/6/2015 2:23:04 PM