Solved

Send Username, password and domain from ms access towards ms outlook

Posted on 2007-03-28
3
260 Views
Last Modified: 2008-02-01
Dear Experts,

I created a button on a form which should be able to check if Outlook is open. If not, the function should send the logon information towards Outlook and open it. Below the code I already found on EE which basicly checks if Oulook is open or not.
First the code which calls the function IsOutLookOpen. It sends the logon and password to the function:

    Dim stlogon As String
    stlogon = Me.OutlookDomain & "\" & Me.OutlookUser
    Dim stpassword As String
    stpassword = Me.OutlookPass
    IsOutlookOpen stlogon, stpassword

Then the function :

Function IsOutlookOpen(stlogon As String, stpass As String) As Boolean
    Dim olApp As Outlook.Application
    Set olApp = CreateObject("Outlook.Application")
    Dim olNs As Outlook.NameSpace
    Set olNs = olApp.GetNamespace("MAPI")
   
    Dim objOL As Object
    On Error Resume Next
    Set objOL = GetObject(, "Outlook.Application")
    If Err.Number = 429 Then
        Set objOL = CreateObject("Outlook.Application")
        If Err.Number = 0 Then
            objOL.Visible = False
            IsOutlookOpen = True
            MsgBox "Outlook has been opened"
        Else
            MsgBox "Outlook failed to open"
            IsOutlookOpen = False
        End If
    Else
        IsOutlookOpen = True
    End If
End Function

Now I need to find out how I can use the parameters send in the function call (stlogon, stpass) to open ms Outlook without any further intervention from the user.

Any ideas?

Thanks a lot in advance!
0
Comment
Question by:jrameuwissen
  • 2
3 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 18809353
I found this snippet of code:

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
objNamespace.Logon "Default Outlook Profile",, False, True    

Where the 3rd and 4th arguments are:

3rd argument: Show Dialog
4th Argument: New Session

The second argument is for a password, but according to this article is for backwards compatibility and is almost never used.

That said, I'm not sure the security model of Outlook will allow you to pass in this information. Much has changed since the onslaught of spam and malware, and Outlook has often "beefed up" security by simply disallowing automated procedures (like, perhaps, automated logins).
0
 
LVL 1

Author Comment

by:jrameuwissen
ID: 18814125
LSMConsulting,

Thanks. I tried using your code but for some reason I still receive a popup which requires a password.
Isn't there a setting in Ms Outlook that I can use, so that I do not have to enter a password anymore?

Thanks again.
0
 
LVL 1

Author Comment

by:jrameuwissen
ID: 19063998
Issue solved. Thanks.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now