Link to home
Create AccountLog in
Avatar of borgtamer
borgtamerFlag for United States of America

asked on

Resolving Outlook Address book entry

I am trying to use a VBA macro to access a shared calendar. I have the GAL entry and have verified that it exists and is valid. Below is the code of the macro:
Public Function OpenSharedCalendar(Name As String) As Object
    Dim myOlApp As Object
    Dim myNamespace As Object
    Dim myRecipient As Object
    Dim fldr As Object
    Dim CalendarFolder As Object
    Set myOlApp = CreateObject("Outlook.Application")
    Set myNamespace = myOlApp.GetNamespace("MAPI")
    Set myRecipient = myNamespace.CreateRecipient("=" & Name)
    If myRecipient.Resolve Then
        Set CalendarFolder = Session.GetSharedDefaultFolder(myRecipient, olFolderCalendar)
    Else
        MsgBox ("Could not resolve '" & Name & "' to obtain shared calendar")
        Set OpenSharedCalendar = Nothing
        Exit Function
    End If
    ' other code
   OpenSharedCalendar = fldr
End Sub

Open in new window


The problem is that
myRecipient.Resolve

Open in new window

returns False. The argument passed to the function is "Project Management". In the Global Address List there are also entries "Project Management Analysis" and "Project Management Training". Hence the
"=" & Name

Open in new window

argument in CreateRecipient function.

Any ideas on what I am doing wrong? Thanks

Borgtamer
ASKER CERTIFIED SOLUTION
Avatar of omgang
omgang
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of borgtamer

ASKER

Did not completely solve the problem.