Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Outlook Object Model
Message
From
27/06/2001 20:38:46
Gavin Reid
L & M Marketing Pty Ltd
Frenchs Forest, Australia
 
 
To
27/06/2001 04:23:36
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00524002
Message ID:
00524461
Views:
11
Hi Kevin,

The following code should help you on your way. It allows you to access another users Outlook Calendar. To access the Calendar you must have delegated access to their Calendar.
* ----- Outlook Account
cOtherUser = "Bart Simpson"

loOutLook   = CREATEOBJECT("Outlook.Application")
loNameSpace = loOutLook.GetNameSpace("MAPI")
loOtherUser = loNameSpace.CreateRecipient(cOtherUser)

* ----- Attempts to resolve a Recipient object against the AddressBook
loOtherUser.Resolve()

IF loOtherUser.Resolved = .T.
    * ----- Recipient object resolved against the AddressBook	
    *       Let's set an error handler to check for access to the Recipients Calendar
    cOnError = ON("ERROR")
    ON ERROR *
    * ----- Let's attempt to access the Recipients Calendar
    loCalendar = loNameSpace.GetSharedDefaultFolder(loOtherUser,9)
    ON ERROR &cOnError
    IF TYPE("loCalendar") = "O"
	* ----- Recipients Calendar could be accessed
        nItemCount = loCalendar.Items.Count
        * ----- Let's loop through the Calendar and obtain a number of properties
        FOR nLoop = 1 TO nItemCount
            WITH loCalendar.Items[nLoop]
                cSubject      = .Subject
                tCreationTime = .CreationTime
                cLocation     = .location
                tStart	      = .start
                nDuration     = .duration
                tEnd	      = .end
            ENDWITH
        ENDFOR
    ELSE
        * ----- Recipients Calendar couldn't be accessed
        MESSAGEBOX("You don't have delegated access to the calendar of " + cOtherUser + "." ;
                 , 16 ;
                 , "Couldn't Access Calendar")
    ENDIF
ELSE
    * ----- Recipient object not resolved against the AddressBook	
    MESSAGEBOX(cOtherUser + " couldn't be resolved agains the AddressBook." ;
             , 16 ;
             , "Couldn't Resolve User")
ENDIF
Hope this helps,
Gavin...

>Hi
>
>Is there a way of opening other people's calendars from the Outlook API?
>
>Thanks
>Kev
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform