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

LVL 1
manfredfieldAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GuitarRichCommented:

Any code behind runs on the server not the client, to get information like that you will have to do some clientside scripting in javascript.

For the OS - you need to look at the user agent string - that will say something like:
; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; .NET CLR 3.5.21022; .NET CLR 1.1.4322; InfoPath.2; Tablet PC 2.0; OfficeLiveConnector.1.3; OfficeLivePatch.0.0
You can get this from Request.Browser.Capabilities["extra"]
This is my user agent string - so my OS is Windows NT based and version 6.0 (I'm running vista) if it had Windows NT 5.1 this would be XP. If you google User Agent String operating system versions you should be able to find them all. Not sute that the straight browsercapabilities object has enough information in it.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GuitarRichCommented:
A list of the microsoft user agent strings for os version:
  • Windows NT 6.0 = Windows Vista
  • Windows NT 5.2 = Windows Server 2003;
  • Windows XP x64 Edition  = Windows NT 5.1
  • Windows XP  = Windows NT 5.01
  • Windows 2000, Service Pack 1 (SP1)  = Windows NT 5.0
  • Windows 2000  = Windows NT 4.0
  • Microsoft Windows  = NT 4.0
0
manfredfieldAuthor Commented:
This is great. thanks Do you know how do I get Outlook??
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

GuitarRichCommented:
you could create an Outlook activeX object like this and get the version that way - then you would need to store that version number in a field somewhere if you wanted the codebehind to be able to use it.
<script type="text/javascript">
oOutlookApp = new ActiveXObject("Outlook.Application");
var version = oOutlookApp.Version;
</script>

Open in new window

0
manfredfieldAuthor Commented:
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.
0
GuitarRichCommented:
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

0
manfredfieldAuthor Commented:
Could this be done in an activex (digitally signed) object with WMI??

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

0
manfredfieldAuthor Commented:
The Request.Browser.Capabilities["extra"] works like a charm. Thanks for this!!
0
GuitarRichCommented:
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.
0
manfredfieldAuthor Commented:
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??
0
manfredfieldAuthor Commented:
Hi,
I'm vb.net but did find this article but I couldn't get it to work.
0
GuitarRichCommented:
0
manfredfieldAuthor Commented:
it's the same article just with a bad vb port. vb moans about the Property part and the inherits
0
GuitarRichCommented:
sorry - not done an ActiveX control myself - might be worth another specific question to see if anyone else knows how.
0
GuitarRichCommented:
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

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.