Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / January 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
OctopusThu - 25 Jan 2007 15:21 GMT
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)
           {
               ......
           }
OctopusThu - 26 Jan 2007 07:36 GMT
I have figured it out myself. Just use:

DateTime.ToString("yyyy-MM-dd HH:mm");

> 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?
[quoted text clipped - 21 lines]
>                 ......
>             }
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.