vba - Access Get subfolder of shared folder meetings -
i have code below should let me retrieve meetings shared sub calendar, doesn't work.
if try access main shared calendar works perfect, not sub calendars..
could point me right way?
public sub getcalendardata(calendar_name string, sdate date, edate date, optional recuritem boolean = true) on error goto errorhandler dim ool outlook.application dim ons outlook.folder dim oappointments outlook.appointmentitem dim oappointmentitem outlook.appointmentitem dim strfilter string dim itemscal outlook.items dim olfolder outlook.folder dim fldcalendar outlook.folder dim icalendar integer dim nmsnamespace outlook.namespace dim objdummy outlook.mailitem dim objrecip outlook.recipient 'set objects set ool = createobject("outlook.application") set nmsnamespace = ool.getnamespace("mapi") set objdummy = ool.createitem(olmailitem) set objrecip = nmsnamespace.createrecipient("shared calendar name") objrecip.resolve 'set filter grab items date range strfilter = "[start] >= " _ & "'" & sdate & "'" _ & " , [end] <= " _ & "'" & edate & "'" itemscal .sort "[start]" .includerecurrences = recuritem end if objrecip.resolved on error resume next set fldcalendar = nmsnamespace.getshareddefaultfolder(objrecip, olfoldercalendar).folders("sub_calendar_name") if not fldcalendar nothing set itemscal = fldcalendar.items if not itemscal nothing each oappointmentitem in itemscal.restrict(strfilter) set objitem = oappointmentitem oappointmentitem icalendar = getsegmentidbyname(calendar_name) meeting_id = insertappointment(icalendar, .start, .end, scrubdata(.subject), scrubdata(.location), format(.start, "long time"), .duration, .body) call getattendeelist(meeting_id, objitem, .recipients) end next end if end if end if 'garbage cleanup set oappointmentitem = nothing set oappoinments = nothing set ons = nothing set ool = nothing exit sub errorhandler: 'msgbox "error: " & err & " | " & error(err) 'whenever error occurs, skip next resume next end sub
the problem fldcalendar
returning nothing
, don't know wrong..
thank you!
keep in mind in cached mode when accessing default folder mailbox, not accessing whole mailbox - folder (but not subfolders) cached in primary ost file.
you can add whole mailbox delegate store (advanced tab of exchange account properties dialog box) , drill down folder store.rootfolder
(where store retrieved namespace.stores
collection).
if using redemption option, version of rdosession.getshareddefaultfolder
(or rdosession.getsharedmailbox
) returns live folder (rdofolder), not cached version, able access subfolders.
Comments
Post a Comment