• Subject: Re: All day events only show up for first day
  • Author: Sue Mosher [MVP]
  • Date: 10 Feb 2010
  • References: 1 2 3 4 5 6 7 8 9
The workaround is the one you've already been given: If you want the event to appear on each day of your printout, your code must keep track of which days the all-day event should appear on.
Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54
"M" <m@n.com> wrote in message news:u7uwsVoqKHA.5896@TK2MSFTNGP04.phx.gbl...
> Ok, that's what I was trying to find out. The appointment only appears > once, basically because it's tied to the start date only, correct? Is > there any way to work around this? I just need some ideas--I should be > able to write the code. Thank you. > > -- > Regards, > M > MCTS, MCSA > "Sue Mosher [MVP]" <suemvp@gmail.com> wrote in message > news:evW6EIoqKHA.3464@TK2MSFTNGP06.phx.gbl...
>> The collection for the full 16-day date range? As JP suggested, you'll >> need to keep track of the dates involved in all-day events. Each such >> appointment will appear in the collection only once. >> -- >> Sue Mosher, Outlook MVP >> Author of Microsoft Outlook 2007 Programming: >> Jumpstart for Power Users and Administrators >> http://www.outlookcode.com/article.aspx?id=54 >> >> >> "M" <m@n.com> wrote in message >> news:OQpquAoqKHA.5940@TK2MSFTNGP02.phx.gbl...
>>>I loop through the collection returned for the date range as shown below. >>> >>> For Each objCalItemSingle In objCalItemColl >>> If objCalItemSingle.AllDayEvent Then >>> strEmailBodyText = strEmailBodyText & "SUBJECT: [ALL DAY EVENT] " & >>> objCalItemSingle.Subject & vbCRLF & " | START TIME: " & >>> objCalItemSingle.StartTime & vbCRLF & _ >>> " | END TIME: " & objCalItemSingle.EndTime & vbCRLF & " | DETAILS (IF >>> AVAILABLE): " & objCalItemSingle.Text & vbCRLF & vbCRLF >>> Else >>> strEmailBodyText = strEmailBodyText & "SUBJECT: " & >>> objCalItemSingle.Subject & vbCRLF & " | START TIME: " & >>> objCalItemSingle.StartTime & vbCRLF & _ >>> " | END TIME: " & objCalItemSingle.EndTime & vbCRLF & " | DETAILS (IF >>> AVAILABLE): " & objCalItemSingle.Text & vbCRLF & vbCRLF >>> End If >>> Set objCalItemSingle = objCalItemColl.GetNext >>> Next >>>
>>
>>> "Sue Mosher [MVP]" <suemvp@gmail.com> wrote in message >>> news:%23X9FjznqKHA.4604@TK2MSFTNGP05.phx.gbl...
>>>> How do you "go through each day within that range"?
>>
>>>> "M" <m@n.com> wrote in message >>>> news:uYdizJnqKHA.4604@TK2MSFTNGP05.phx.gbl...
>>>>> dtmTimeStart is today's date >>>>> dtmTimeEnd is today's + 16 (or any number) >>>>> >>>>> I set the filter range using the two variables above, and then go >>>>> through each day within that range to look for items in each day's >>>>> calendar. Eventually I send the info via e-mail. >>>>> >>>>> Everything so far is working correctly. I see single entries, such as >>>>> Monday 12:00 PM - 1:00 PM, and recurrences. But the script only reads >>>>> the first day of all day events that span multiple days. This is seems >>>>> to be the way Outlook works, so I don't think it's problem, per se, >>>>> but I need to try to work around that if possible. >>>>> >>>>> Thank you. >>>>> >>>>> -- >>>>> Regards, >>>>> M >>>>> MCTS, MCSA >>>>> "Sue Mosher [MVP]" <suemvp@gmail.com> wrote in message >>>>> news:ui642$mqKHA.5116@TK2MSFTNGP04.phx.gbl...
>>>>>> What are typical values for dtmTimeEnd and dtmTimeStart. As the >>>>>> article you cited explains, the query needs to look for items that >>>>>> start before the end date and end after the start date. The article >>>>>> at >>>>>> http://blogs.msdn.com/waltwa/archive/2007/03/14/finding-appointments-within-a-specific-timeframe.aspx >>>>>> provides a nice graphical representation of what may seem like an >>>>>> illogical approach at first. >>>>>> >>>>>> To ask the question another way, how exactly do you invoke the code >>>>>> when "my script looks at Tuesday and Wednesday"?
>>>>
>>>>>> >>>>>> "M" <m@n.com> wrote in message >>>>>> news:ufxHOkmqKHA.728@TK2MSFTNGP04.phx.gbl...
>>>>>>> Here's the code. >>>>>>> >>>>>>> Set objCDOSession = CreateObject("MAPI.Session") >>>>>>> objCDOSession.Logon , , , , , , strMAPIProfile >>>>>>> Set objCalFolder = >>>>>>> objCDOSession.GetDefaultFolder(CdoCALENDAR_FOLDER) >>>>>>> Set objCalItemColl = objCalFolder.Messages >>>>>>> Set objCalItemFilter = objCalItemColl.Filter >>>>>>> Set objCalItemFilterField1 = >>>>>>> objCalItemFilter.Fields.Add(CdoPR_START_DATE, dtmTimeEnd) 'This is >>>>>>> the END date! The values for start and end times must be reversed. >>>>>>> See http://support.microsoft.com/kb/192404. >>>>>>> Set objCalItemFilterField2 = >>>>>>> objCalItemFilter.Fields.Add(CdoPR_END_DATE, dtmTimeStart) 'This is >>>>>>> the START date! The values for start and end times must be reversed. >>>>>>> See http://support.microsoft.com/kb/192404. >>>>>>> For Each objCalItemSingle In objCalItemColl >>>>>>> If objCalItemSingle.AllDayEvent Then >>>>>>> strEmailBodyText = strEmailBodyText & "SUBJECT: [ALL DAY EVENT] " & >>>>>>> objCalItemSingle.Subject & vbCRLF & " | START TIME: " & >>>>>>> objCalItemSingle.StartTime & vbCRLF & _ >>>>>>> " | END TIME: " & objCalItemSingle.EndTime & vbCRLF & " | DETAILS >>>>>>> (IF AVAILABLE): " & objCalItemSingle.Text & vbCRLF & vbCRLF >>>>>>> Else >>>>>>> strEmailBodyText = strEmailBodyText & "SUBJECT: " & >>>>>>> objCalItemSingle.Subject & vbCRLF & " | START TIME: " & >>>>>>> objCalItemSingle.StartTime & vbCRLF & _ >>>>>>> " | END TIME: " & objCalItemSingle.EndTime & vbCRLF & " | DETAILS >>>>>>> (IF AVAILABLE): " & objCalItemSingle.Text & vbCRLF & vbCRLF >>>>>>> End If >>>>>>> Set objCalItemSingle = objCalItemColl.GetNext >>>>>>> Next >>>>>>>
>>>>>>>>> >>>>>>>>> I created a VBS script using CDO to look at all the items in a >>>>>>>>> particular Exchange mailbox calendar between a specific date >>>>>>>>> range. I've almost got eveverything working, but one thing I >>>>>>>>> noticed is that all day events which span several days actually >>>>>>>>> consists of only a single entry in the calendar. Outlook is smart >>>>>>>>> enough to show the event spanning several days, but it only stores >>>>>>>>> the entry on the start date. In case my explanation wasn't clear, >>>>>>>>> I'll give an example: >>>>>>>>> >>>>>>>>> I have an all day event that spans Monday, Tuesday, and Wednesday. >>>>>>>>> When viewed in Outlook, I can see the event spanning all three >>>>>>>>> days. >>>>>>>>> When my script runs and looks for items for that entire week, the >>>>>>>>> script only sees one entry for the 3-day event, and that's on >>>>>>>>> Monday. When the script looks at Tuesday and Wednesday, it doesn't >>>>>>>>> see the event at all. >>>>>>>>> >>>>>>>>> It seems that this issue is by design, and seems logical to me, so >>>>>>>>> I understand why this is happening. Is there any way to work >>>>>>>>> around this, so that when my script looks at Tuesday and >>>>>>>>> Wednesday, it would see the 3-day event?
>> >>
> >
10 Feb 2010All day events only show up for first day.M
10 Feb 2010|- Re: All day events only show up for first day.Sue Mosher [MVP]
10 Feb 2010|  \ Re: All day events only show up for first day.M
10 Feb 2010|     \ Re: All day events only show up for first day.Sue Mosher [MVP]
10 Feb 2010|        \ Re: All day events only show up for first day.M
10 Feb 2010|           \ Re: All day events only show up for first day.Sue Mosher [MVP]
10 Feb 2010|              \ Re: All day events only show up for first day.M
10 Feb 2010|                 \ Re: All day events only show up for first day.Sue Mosher [MVP]
10 Feb 2010|                    \ Re: All day events only show up for first day.M
10 Feb 2010|                       |- Re: All day events only show up for first day.M
10 Feb 2010|                       |  \ Re: All day events only show up for first day.Sue Mosher [MVP]
10 Feb 2010|                       \ Re: All day events only show up for first day.Sue Mosher [MVP]
10 Feb 2010|                          \ Re: All day events only show up for first day.M
10 Feb 2010\ Re: All day events only show up for first day.JP
10 Feb 2010   \ Re: All day events only show up for first day.M
10 Feb 2010      \ Re: All day events only show up for first day.JP
10 Feb 2010         \ Re: All day events only show up for first day.M
Contact Us
All times are in (US) Eastern Daylight Time (GMT -4:00)