Opening Outlook with attachment

Discussion in 'ASP .Net' started by =?Utf-8?B?RGFuaXNo?=, Mar 3, 2004.

  1. Hi all,
    I am trying to open outlook express along with an attachment.
    I have added a reference to the Microsoft outlook Library
    I am using the following lines of code.
    =============================
    Outlook.Application OutApp = new Outlook.Application();
    Outlook.OlItemType olItem = new Outlook.OlItemType();
    Outlook.MailItem OutMail = (Outlook.MailItem)OutApp.CreateItem(olItem);
    OutMail.To = ToAddress;
    //OutMail.SenderName = FromAddress;
    OutMail.Subject= Subject;
    //OutMail.Attachments.Add(Filename,);
    OutMail.Body = Body;
    OutMail.Display(OutApp);
    =============================

    While compiling it doesnt give any error. However when I run the code it fails at the first line where I am trying to create an object of Outlook Application type
    The error says " Acess is denied"

    When I try to open outlook using mailto: it opens fine, but I am not able to attach a file to it at the runtime.
    Any help on this will be highly appreciated.
     
    =?Utf-8?B?RGFuaXNo?=, Mar 3, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Niall

    opening outlook express

    Niall, Apr 22, 2004, in forum: Java
    Replies:
    16
    Views:
    3,220
    Roedy Green
    Apr 24, 2004
  2. =?Utf-8?B?bWF2aXNhaGRhcw==?=

    Opening an email in the Outlook window

    =?Utf-8?B?bWF2aXNhaGRhcw==?=, Aug 29, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    270
    =?Utf-8?B?bWF2aXNhaGRhcw==?=
    Aug 29, 2006
  3. phil2phil

    asp.net opening email in outlook

    phil2phil, Nov 3, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    1,000
    Mark Rae
    Nov 3, 2006
  4. param
    Replies:
    3
    Views:
    1,612
    mearvk
    Dec 7, 2006
Loading...

Share This Page