Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2011
    Posts
    2

    Unanswered: Permission to access Outlook GAL from Access

    I have the following code to retrieve a filtered list of names and email addresses from the MS Outlook GAL.

    When I am stepping through the code I get prompted for permission to access the GAL on the line of code that retrieves the name, which is correct.

    But when I am not stepping through the code I do not get the prompt and Access appears to hang. It's like Windows is waiting for me to respond to the prompt but I can't because it's not visible. (And no, it's not hiding behind another window)



    Private Sub DirectoryButton_Click()
    Const CDoPR_EMAILx = &H39FE001E

    Dim mySMTP As String, myName As String

    Dim cdoSession As New MAPI.Session
    Dim cdoGAL As MAPI.AddressEntries

    Dim q As Long
    EmailListbox.RowSource = ""
    EmailListbox.AddItem "Name" & ";" & "Email"

    Set cdoSession = CreateObject("MAPI.session")
    cdoSession.Logon , , False, False, 0
    Set cdoGAL = cdoSession.AddressLists("Global Address List").AddressEntries
    Set cdoFilter = cdoGAL.Filter
    cdoFilter.Name = Me!Name


    'On Error Resume Next
    For q = 1 To cdoGAL.Count

    ' ***** This is where I should get the prompt to allow access to the GAL
    myName = cdoGAL.item(q).Name
    mySMTP = cdoGAL.item(q).Fields(CDoPR_EMAILx)

    EmailListbox.AddItem myName & ";" & mySMTP

    Next
    On Error GoTo 0
    Set cdoGAL = Nothing
    cdoSession.Logoff
    Set cdoSession = Nothing

    End Sub


  2. #2
    Join Date
    Nov 2011
    Posts
    2

    Permission to access Outlook GAL from Access

    I just found that it's a Windows problem. I use multiple monitors. When I have Access on the primary monitor I get the prompt. When I have Access on the secondary monitor I do not get the prompt and Access appears to hang.

    Case closed.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •