Problem with MAPIFolder.Items.Restrict(), C#, Outlook 2003 and ear

G

Guest

I want to aquire all items in the folder that starts later than a specified
time. How can I use the Restrict method to achieve this?

In MSDN, there is a VB example:

sFilter = "[LastModificationTime] > '" & Format("1/15/99 3:30pm", "ddddd
h:nn AMPM") & "'"

But how about C#?
I tried using String.Format with the following code but failed:

Outlook.Items appointmentItems;
try
{
string strStartTime = String.Format(startTime.ToString(),
"ddddd h:nn AMPM");
appointmentItems = folder.Items.Restrict("[MessageClass] =
'IPM.Appointment'");
appointmentItems = folder.Items.Restrict("[Start] >= '" +
strStartTime + "'"); //Exception occurred here
}
catch(Exception ex)
{
......
}
 
Joined
Oct 30, 2014
Messages
1
Reaction score
0
Actually, that didn't work for me. I got it working with DateTime.ToString("MMMM d, yyyy hh:mm tt")
 
Joined
Mar 30, 2015
Messages
1
Reaction score
0
hi, iam having problems using restrict method with custom form fields.
is it possible to restrict based on userproperties(if that's what they are called?)
 

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