Is UserProperty what I need?

R

Randy Harris

I'm creating Calendar appointments in code. In a case where the appointment
information gets changed, I need for the code to determine if the appt has
already been created or not so that it can be updated. The subject, and even
the date can get changed.

The appointment event has a unique ID assigned to it. Is there someplace,
other than the subject or body, where I can store that ID? Is this
something that could be done with a UserProperty?
 
R

Randy Harris

And, if this is the way to go, how can I test whether the AppointmentItem
has that UserProperty or not? Some appointments will have it and some
won't.
 
S

Sue Mosher [MVP-Outlook]

Yes, you could create a UserProperty to store that information. That's a very common scenario.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Greg J

UserProperties are pretty handy but they can be a but clunky. Later
versions of Outlook seem to be getting better.
The approach I use is to get the "UserProperties.Count" for an item.
If its zero you can safely add the new property as none currently
exist. If its not zero, you can iterate through each userproperty and
check its name (2003 has a handy "Find" property that saves iteration
needed in previous versions).
If your app is the only one assigning userproperties to these items you
could simply use the Count property to determine if the userproperty
exists or not.
 
S

Sue Mosher [MVP-Outlook]

Set prop = Item.UserProperties("propname")
If prop Is Nothing Then
' the item doesn't have the property
End If

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top