Reading Appointment folders in Outlook 
Author Message
 Reading Appointment folders in Outlook

I am trying to read the appointment items in several calendar folders.  The
Default Calendar folder has three calendar sub-folders.

I have been successful in getting down to the sub-folders and reading the
collection of items (that were first "restricted" to a date/time range).
However, I cannot figure out how to view the properties of the AddressItem
object (i.e. Subject, Start, End, etc).

Here is a sample of my code:
============start of code sample
'Set an array of conference room schedules that are sub folders of the
default Calendar folder
dim aryRooms(1)
aryRooms(0) = "ConfRoom1"
aryRooms(1) = "ConfRoom2"

'set the start and end dates to use for restricting the appointments desired
dtStartDate = cdate("12/09/2002 12:01:00 AM")
dtEndDate = cdate("12/09/2002 11:59:00 PM")

Set objOutlook = CreateObject("Outlook.Application.8")
Set myNameSpace = objOutlook.GetNameSpace("MAPI")
Set myParentFolder = myNameSpace.GetDefaultFolder(9)

'Check each conference for appointments
For idx = 0 to UBound(aryRooms)
   dtStartDate = cdate(ReqDate & " 12:01:00 AM")
   dtEndDate = cdate(ReqDate & " 11:59:00 PM")
   set myFolder = myParentFolder.Folders(aryRooms(idx))
   Set myItems = myFolder.Items
   myItems.Sort "[Start]", False
   strRestrict = "[Start] >= '" & datevalue(dtStartDate) & "' and [Start] <
'" & datevalue(dateAdd("d", 1, dtEndDate)) & "'"
   Set myItem = myItems.Restrict(strRestrict)
   'Display a message for each appointment found
   for each obj in myItem
      if TypeName(myItem) <> "Nothing" then
           msgbox "Appointment: " & myItem.Start & " till " & myItem.End &
" - " & myItem.Subject
      else
           exit for
      end if
  next
next
============end of code sample

With the above code, I get the error "Object doesn't support this property
or method 'myItem.Start'" (code 800A01B6).  I understand why I get the
message, what I don't understand is how to get myItem set to the AddressItem
object so I can then see the desired fields.

Any thoughts would be greatly appreciated!

Stephen Deal



Sat, 28 May 2005 09:24:44 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Outlook 2000 VBA: Making New Appointment in Current Folder

2. Outlook - Reading from diferent folders/ read/unread flag

3. Outlook - Reading from diferent folders/ read/unread flag

4. reading outlook appointment items and date problems

5. Export | Import Outlook Appointments without Outlook

6. Can you read the contact folder in outlook

7. Reading Outlook Express mail folders

8. Reading Outlook Folders with Visual Basic

9. ie 4, outlook as calendar, passing appointments

10. Microsoft Outlook: Calendar: Hiding appointments and Categories

11. Add Appointment to Outlook from Website

12. Contacts and Appointments with Outlook/VBS

 

 
Powered by phpBB® Forum Software