Syl21 Posted March 31, 2010 Share Posted March 31, 2010 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 $olFolderCalendar=9 $oOutlook = _OutlookOpen() $Items = $oOutlook.GetNamespace("MAPI").GetDefaultFolder($olFolderCalendar).Items $t=0 for $Item In $Items $t+=1 msgbox(1,"test"&$t,$Item.subject) If IsObj($Item.UserProperties($SoftName)) Then $Item.Delete EndIf Next Link to comment Share on other sites More sharing options...
picea892 Posted March 31, 2010 Share Posted March 31, 2010 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 endif endif endif 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 EndFunc Link to comment Share on other sites More sharing options...
Syl21 Posted March 31, 2010 Author Share Posted March 31, 2010 Hello, 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'") EndWith 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now