?
Solved

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

Posted on 2007-03-28
3
Medium Priority
?
309 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 2000 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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…
Suggested Courses

752 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