Jump to content
Sign in to follow this  

Missing Outlook Calendar Items

Recommended Posts


I'm creating a code for creating and deleting calendar events in outlook.

When I create an events, I use a UserProperties with my softwarename to recognize them later.

When I scan to delete, I just want scan every event and verify if the UserProperties is well Set (Just to be sure I don't delete a IMPORTANT handmade event)

Normally this code must work but I don't know why, $Items don't contain every calandar events...

Some body have an idea???? Thanks in Advance

$oOutlook = _OutlookOpen()
$Items = $oOutlook.GetNamespace("MAPI").GetDefaultFolder($olFolderCalendar).Items
for $Item In $Items
    If IsObj($Item.UserProperties($SoftName)) Then

Share this post

Link to post
Share on other sites

I would investigate recurrence state, that might be your problem. I had many problems with that with some of my scripts. Just to get you started this is how I have queried for it.

if $m.RecurrenceState=1 Then
            if $m.GetRecurrencePattern.dayofweekmask=bitwday(_DateToDayOfWeek(StringLeft($startdate,4),Stringmid($startdate,5,2),Stringmid($startdate,7,2))) then
                             if $m.GetRecurrencePattern.recurrencetype= 1 then ;weekly pattern
                             elseif _DateToDayOfWeek (StringLeft($m.GetRecurrencePattern.starttime,4)+110,Stringmid($m.GetRecurrencePattern.starttime,5,2),Stringmid($m.GetRecurrencePattern.starttime,7,2))=_DateToDayOfWeek(@year,@mon,@mday) then ;monthly pattern
func bitwday($day)
    if $day=1 then return 1 ;sunday
    if $day=2 then return 2 ;monday
    if $day=3 then return 4
    if $day=4 then return 8
    if $day=5 then return 16
    if $day=6 then return 32
    if $day=7 then return 64

Share this post

Link to post
Share on other sites


To be sure I have try this:

With $oOutlook.GetNamespace("MAPI").GetDefaultFolder($olFolderCalendar).Items
            .Sort("[Start]", False)
            .IncludeRecurrences = True
            $Items=.Restrict("[Start] >= '"&StringStripCR(_ExcelReadCell($oExcel, $DateLine, $StartDataColumn))&" 00:00'")

With .IncludeRecurrences = True & False But nothing Change, I don't have totaly understand your answer...

Sorry, I'm french and my english still bad!!!

Thx Again

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this