Re: Opening Outlook new MailItem Display from Asp.net?

From: Sue Mosher [MVP-Outlook] (suemvp_at_outlookcode.com)
Date: 05/10/04

  • Next message: Adam Johnson: "Block email using a wildcard for subdomain"
    Date: Mon, 10 May 2004 12:31:56 -0400
    
    

    If you know IE is the browser, you could use VBScript code similar to this
    in your client script:

        Set objOL = CreateObject("Outlook.Application")
        Set objMsg = objOL.CreateItem(0)
        objMsg.Attachments.Add("\\server\share\filename")
        objMsg.Display

    A variation would be to check if Outlook is running first. The sample at
    http://www.outlookcode.com/codedetail.aspx?id=83 is for VB/VBA, not
    VBScript, but you'll see how to use GetObject. You can also use
    Namespace.Logon without a profile name and prompt the user to choose a
    profile.

    As for WebDAV, it does not require Outlook to be installed on the client or
    configured in a particular way. The ASP server talks directly to the
    Exchange server. That means, of course, that it needs appropriate
    permissions. .

    -- 
    Sue Mosher, Outlook MVP
    Author of
         Microsoft Outlook Programming - Jumpstart for
         Administrators, Power Users, and Developers
         http://www.outlookcode.com/jumpstart.aspx
    "John Scalco" <jscalco@rtpdig.org> wrote in message
    news:OGqiiHqNEHA.624@TK2MSFTNGP11.phx.gbl...
    > Sue,
    > thanks for the response.
    >
    > "Sue Mosher [MVP-Outlook]" <suemvp@outlookcode.com> wrote in message
    > news:eznQUg7MEHA.3472@TK2MSFTNGP10.phx.gbl...
    > > The code behind your web form is server code. To create a new mail
    message
    > > that uses the user's own Outlook profile, you would need to use
    > client-side
    > > code (JScript unless you know everyone is using IE as their browser, in
    > > which case you could use VBScript). A solution I've been prototyping
    (not
    > > quite ready for public consumption, alas) is a custom web control that
    > loads
    > > the script from a .js file on the server with the
    > RegisterClientScriptBlock
    > > method.
    >
    > Sounds like a neat component/solution.
    >
    > I do know that the users will be using Internet Explorer. The solution is
    > run on an Intranet and only works with IE6 - no options. So the script
    side
    > with user profiles sounds fine to me. Could you point me to any samples?
    >
    > The part I need to emphasize here is that  I would want to be able to
    > display the Mail dialog (MailItem dialog), the window, which appearas when
    > you call MailItem.Display();
    > I need this because
    > 1. I want to insert the document which they were viewing in the web page
    > into this email.
    > 2. I would like to allow the user to be able to access their
    Address/contact
    > book so they can choose who will the mail with the image will be sent to .
    >
    > >
    > > A further consideration is that the Outlook.Application object is not
    > > considered safe for scripting. Therefore, depending on the user's
    browser
    > > security settings, instantiating Outlook.Application may work, trigger a
    > > prompt (to which the user can say Yes or No), or be disabled outright.
    Or
    > > Outlook may not be present on the client machine at all. Handling all
    > these
    > > cases is part of the work that I still need to do on my prototype, and
    I'm
    > a
    > > pretty lousy JScript programmer so it will take me a while.
    >
    > On the server side of asp.net, I have not successfully been able to create
    a
    > an instance of Outlook.Application,
    > this is the line it dies on.
    >
    >
    > >
    > > The other approach to consider is using a mailto: url, but it may be
    hard
    > to
    > > get that to add an attachment unless it's from a local or mapped network
    > > drive.
    >
    > - I have access to where the file store is, so I can read the filename.
    >
    > >
    > > Still another choice, if you're in an Exchange environment, is to use
    use
    > > your own web form to create the message and submit it via WebDAV. (Out
    of
    > my
    > > scope of knowledge, but the docs start at
    > > http://msdn.microsoft.com/exchange/.)
    >
    > - Problem is the user may not have Exchange installed, so it's iffy. They
    > may not have outlook either. I need to find out a way to detect this.
    Maybe
    > I could get away with just catching an exception and saying 'outllook mail
    > is not installed' ???
    >
    > Or would that be cheesy?
    >
    > >
    > > If you don't care about sending via the user's Outlook profile, then use
    > > server-side SMTP.
    >
    > I do want to use the User's profile - if it exists, but I also need access
    > to their address book, so they can see a list of the contacts....
    >
    > Thanks for the response Sue, I appreciate it.
    > any other tips/suggestions woudl be appreciated.
    >
    > sincerely,
    > John Scalco
    >
    >
    > >
    > > "John Scalco" <jscalco@rtpdig.org> wrote in message
    > > news:eN%23Gg$5MEHA.4036@TK2MSFTNGP12.phx.gbl...
    > > >
    > > > Hi,
    > > > I was wondering if it's possible to open an Outlook 'new mail' dialog
    > and
    > > > insert an attachment from an ASP.Net web page.
    > > >
    > > > I'm trying to run this from the Intranet and the I do have outlook on
    my
    > > > desktop machine, which is where I am opening the page from, as would
    > other
    > >
    > > > folks here.
    > > >
    > > > I put together some code (C#), which works wonderfully from a winforms
    > > app,
    > > > but in the webforms when it hits the Outlook.Appliaction ol = new
    > > > Outlook.ApplicationClass();
    > > > it dies... times out with an exception "access denied"
    > > >
    > > > I suspect that this might be possible, but is related to the
    permissions
    > > on
    > > > the site.
    > > >
    > > > Is there anyway to do this?
    > > >
    > > > and while I'm asking, is there anyway to determine if outlook is
    > installed
    > > > (from a client or server) programmatically... aside from catching an
    > > > exception if it fails?
    > > >
    > > > thanks for your help in advance,
    > > > Sincerely,
    > > > John Scalco
    > > >
    > > >
    > >
    > >
    >
    >
    

  • Next message: Adam Johnson: "Block email using a wildcard for subdomain"

    Relevant Pages

    • Re: Banana Republic (was Re: OpenVMS Book Wins award)
      ... overtaken by the more prosaic aspects of supporting WASD. ... for example), that it is better economy, if a client breaks the ... to allow a script to run to completion rather than try and ... The server just throws away ...
      (comp.os.vms)
    • Re: Regarding a selection for mobile code/scripting language
      ... Client Side scripting, so the server can send script commands to the client. ... I decided they should be scripted and mobile code. ...
      (Vuln-Dev)
    • Re: Shared fax
      ... I tried on one workstation to install an outlook 2003 and connected to the ... > What is your client computer's Outlook version? ... > Integration\Windows Small Business Server 2003\Logs''. ...
      (microsoft.public.windows.server.sbs)
    • Re: HTTPSConnection script fails, but only on some servers (long)
      ... (HTTP/CONNECT + switch to HTTPS) ... wget and my python script. ... >>The python script works with server A, ... the problem seems to depend on both the client ...
      (comp.lang.python)
    • RE: Outlook trying to connect.......
      ... their primary DNS entry and also the Wins server IP address for Netbios name ... The Outlook clients all have SP2 and all pcs are running Windows XP SP2. ... On the client pc I have been getting the following event ids: ... does outlook client connect to exchange server ...
      (microsoft.public.windows.server.sbs)