Creating a unique appointment for later amendment

M

Martin Teefy

Hi,

I have a CRM system that uses a calendar control with the event being stored in a database and also in Outlook so blackberry/iphone can see the appts.

But if the user changes the date/time of the appointment or deletes it with the CRM system I need to easily find the appt in outlook hence the unique sequence number per userid

I'm using the following code in VB6 based on some C# sample discussed in one of the pages i found at Sue Mosher's site but i'm not sure what the 4th argument in C# is for:

With objappt

' Read next seq number from the database per user
m_iUniqueId = GetLatestID + 1
m_sUniqueKey = m_pEditingEvent.ScheduleID & "-" & m_iUniqueId

' e.g. 4-23 user id and unique #
.UserProperties.Add m_sUniqueKey, OlUserPropertyType.olText, True

.Save

End With

Will this work without the 4th argument and what would be the Find clause to use in conjunction with the 4-23 example value so i can delete or updae the appt?

Any advice appreciated
 
K

Ken Slovak - [MVP - Outlook]

The 4th argument is for the display format of the user property. It can be
omitted in VB6 code if desired. However, you seem to be adding the property
with a named based on the unique key rather than using a specific name and
setting the value of the property to the key value. Your way would use up
the number of available user properties pretty quickly and would clog up
Exchange with user properties. It would also make it harder to find things.

What version of Outlook are you coding for? Please mention that sort of
thing when you post. If this is for Outlook 2007 or later you can use
GlobalAppointmentID as a key value to find any appointment, it will retain
that value even with appointment changes or updates.

I would name that property a fixed name, say "ApptKey". So the add function
should be changed to return a UserProperty that you can then set:

Dim oProp As Outlook.UserProperty

Set oProp = .UserProeprties.Add("ApptKey", OlUserPropertyType.olText, True)
oProp.Value = m_sUniqueKey


A Find clause would use something like this:

Find("[ApptKey] = '" & sValueToFind & "'")

In that case sValueToFind is the key value you want to find in that
UserProperty.
 

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