Link to home
Start Free TrialLog in
Avatar of manfredfield
manfredfield

asked on

Getting Outlook Version in ASP.net

Hi,
We have a vb.net asp webpage that checks things like browser, screen resolution as we're checking the suitability for one of the services we offer but im struggling to get the Outlook version and the actual OS version of the client PC. The OS comes through but just says WinNT rather than Windows XP SP2 or the like and the outlook version it just picks up the copy of Outlook on the server.

My code is below

Please help

Thanks
Ian

Dim ol As Object
ol = CreateObject("Outlook.Application")
OutlookVersion = ol.Version
 
Dim browcap As HttpBrowserCapabilities = Request.Browser
Response.Write(browcap.Platform)

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of GuitarRich
GuitarRich
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of manfredfield
manfredfield

ASKER

This is great. thanks Do you know how do I get Outlook??
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm afraid the JS didn't work. I get Automation Server Can't Create object. The server hasn't got Outlook on it but the client PC that is opening the webpage does.
the javascript should be running on the client - I would imagine its to do with security permissions. I found this way of doing it and it mentions errors when activeX controls that are not marked as safe are run:

1.2       Prerequisites
a.    Outlook Express 2003 must be installed on the clients machine with the default settings.
b.    The Initialize and Script ActiveX controls not marked as safe option should be selected as Enable.
Open Internet Explorer, go to Tools, Internet Options.  Click on the security page and make sure the "Local Intranet" zone is selected at the top.  Then click on Custom Level at the bottom.  In the following window you will see  settings for Initialize and Script ActiveX controls not marked as safe, select the option enable under the same.

c.    Here it is assumed that the client will only send emails on local DNS over intranet. If the client needs to send email on a DNS other then the local DNS over Internet then the settings for the Internet Zone must be changed as mentioned in the section 1.2->b of this document.
d.   Use the system Configuration utility (Msconfig.exe) to examine the services and system startup for third-party applications that might restrict running code in the Office Application.
For example, Outlook Automation applications may fail because you are running an antivirus program that has "script blocker" features.

Alternatively, follow these steps in Outlook to disable third-party add-ins:
1.
On the Tools menu, click Options.
2.
On the Other tab, click Advanced Options.
3.
In the Advanced Options dialog box, click Add-In Manager.
4.
Click to clear the check box for any third-party add-in.
5.
Restart Outlook.

If this method resolves the problem, contact the third-party antivirus vendor for more information about an update to the antivirus program.
 
 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<HTML> 
          <HEAD> 
                   <title>WebForm1</title> 
<script language="javascript"> 
function SendAttach() 
{ 
          var theApp   //Reference to Outlook.Application 
          var theMailItem     //Outlook.mailItem 
    //Attach Files to the email 
    var attach1 = "c:\\temp\\sheet.xls" 
    var attach2 = "c:\\temp\\mail.doc" 
    var attach3 = "c:\\temp\\test.txt" 
    //Construct the Email including To(address),subject,body 
    //var recipient 
    var subject = "Email Using JavaScript" 
    var msg = "This is a test mail,sent to you using javascript by kushan thakershy" 
    //Create a object of Outlook.Application 
    try 
    {
         var theApp = new ActiveXObject("Outlook.Application") 
            
          var theMailItem = theApp.CreateItem(0) // value 0 = MailItem 
          //Bind the variables with the email 
          theMailItem.to = "venkatalakshmi.pingali@wipro.com" 
          theMailItem.Subject = (subject); 
          theMailItem.Body = (msg); 
          theMailItem.Attachments.Add(attach1) 
          theMailItem.Attachments.add(attach2) 
          theMailItem.Attachments.add(attach3) 
          //Show the mail before sending for review purpose 
          //You can directly use the theMailItem.send() function 
          //if you do not want to show the message. 
          theMailItem.display() 
          } 
    catch(err) 
    { 
    alert("The following may have cause this error: \n"+ 
     "1. The Outlook express 2003 is not installed on the machine.\n"+ 
     "2. The msoutl.olb is not availabe at the location "+ 
     "C:\\Program Files\\Microsoft Office\\OFFICE11\\msoutl.old on client's machine "+ 
     "due to bad installation of the office 2003."+ 
     "Re-Install office2003 with default settings.\n"+ 
     "3. The Initialize and Scripts ActiveX controls not marked as safe is not set to enable.") 
    document.write("<a href=\""+"./testemail.asp"+"\""+">"+"Go Back"+"</a>") 
    } 
          
} 
  
</script> 
                   <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> 
                   <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1"> 
                   <meta name="vs_defaultClientScript" content="JavaScript"> 
                   <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> 
          </HEAD> 
          <body MS_POSITIONING="GridLayout"> 
                   <form id="Form1" method="post" runat="server"> 
                             <INPUT style="Z-INDEX: 101; LEFT: 200px; WIDTH: 128px; POSITION: absolute; TOP: 144px; HEIGHT: 32px" 
                                      type="button" value="Button" onclick="SendAttach()"> 
                   </form> 
          </body> 
</HTML> 

Open in new window

Could this be done in an activex (digitally signed) object with WMI??

I don't think the users will know to allow unsafe etc..

The Request.Browser.Capabilities["extra"] works like a charm. Thanks for this!!
I would have thought that an ActiveX control would be able to do it - like you say it will need to be trusted by the browser tho.
I can get it signed and then put on the classic (if the yellow window pops up type mesage) like adobe do. Do you know where to start with an Activex Control??
Hi,
I'm vb.net but did find this article but I couldn't get it to work.
it's the same article just with a bad vb port. vb moans about the Property part and the inherits
sorry - not done an ActiveX control myself - might be worth another specific question to see if anyone else knows how.
or - here's the fixed VB code for that example

Namespace ActiveXDotNet
 
    Public Interface AxMyControl
        Property UserText() As String
 
    End Interface 'AxMyControl
 
    Public Class myControl
        Inherits UserControl
        Implements AxMyControl
 
        Private mStr_UserText As [String]
 
        Public Property UserText() As String Implements AxMyControl.UserText
            Get
                Return mStr_UserText
            End Get
            Set(ByVal Value As String)
                mStr_UserText = Value
                'Update the text box control value also.
                'txtUserText.Text = value
            End Set
        End Property
    End Class 'myControl
 
End Namespace

Open in new window