View Single Post
  #6  
Old November 20th 06, 12:27 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Appointment form customized and face problems

This would be the correct code to ignore items without the custom property:

On Error Resume Next
For Each itm in itms
Set prop = itm.UserProperties("Tasks")
If Not prop Is Nothing Then
MsgBox "Tasks-" & prop.Value
End If
Next

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Safal" wrote in message ...
Here is the code i am using -

'Set reference to default Calendar folder
Set nms = Application.GetNamespace("MAPI")
Set fld = nms.GetDefaultFolder(9)
For Each itm in itms
If Not IsObject(itm.UserProperties("Tasks")) Then
MsgBox "Tasks-" & itm.UserProperties("Tasks").Value
End If
Next

My assumption was IsObject(itm.UserProperties("Tasks")) fails for those
entries in the calendar that were made prior to adding the customized field.
But i was wrong as i get into that loop for every item on the calendar and an
error shows up on the line "itm.UserProperties("Tasks").Value". But if i skip
those entries and check for the latest entries the same works fine.

Also face yet another problem that of a calendar having appoinment entries
prior to the form customization. In such a case the previous entries would
not have the customised fields i am looking for. How do i handle the same in
the VBScript code such that i can skip such entries ?


Ads