Help, How to use POOM ItemId and Restrict method?

B

Batterhead

hi there,

i use c# and want to locate an appointment item in the appointment
collection. i tried different ways but it keeps reporting "The query
string is incorrectly formatted.". below is what i have tried, any
idea? thanks.

string ArgsItemId = "1073741828";
AppointmentCollection acApptColn =
olsSession.Appointments.Items.Restrict("[ItemId] = " + ArgsItemId);
AppointmentCollection acApptColn =
olsSession.Appointments.Items.Restrict("[ItemId] = \"" + ArgsItemId +
"\"");
AppointmentCollection acApptColn =
olsSession.Appointments.Items.Restrict("[ItemId] = '" + ArgsItemId +
"'");
AppointmentCollection acApptColn =
olsSession.Appointments.Items.Restrict("[ItemId] = " +
Convert.ToInt32(ArgsItemId));

batterheadccw
 
P

Peter Foot [MVP]

ItemId is a class in the managed libraries to abstract the POOM OID and MAPI
ENTRYID values. Replace with [Oid] in your query and it will work. However,
if as it seems you want to retrieve a single item by Oid you'd be better off
using the Appointment constructor which accepts an ItemId e.g.

Appointment a = new Appointment(new ItemId(1073741828));

Peter
 

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