Solved

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

Posted on 2007-03-28
3
299 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 85

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

717 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