By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,010 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

Finding an outlook appointment using ".find" fuction

P: n/a
I am writing an application to retrieve appointments from Outlook, I have the appointment items sorted by
"Start" field and now I want to find the first record which's "Start" value is later than now (future appointment

The relevant piece of my current code

Dim oCalendar As Outlook.MAPIFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFo lderCalendar
Dim oItems As Outlook.Items = oCalendar.Item
oItems.Sort("Start"
oItems.IncludeRecurrences = Tru
Dim oAppt As Outlook.AppointmentItem = oItems.Find("[Subject] = ""Flight, CO 0516 2:10pm"""

What is the syntax to replcae the ("[Subject] = ""Flight, CO 0516 2:10pm""") in the last line to reflect what I need
something like ".Find("[Start] >" & Now.ToString)" - which does not wor

Your help is greatly appriciate
Thanks
Ori :)
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Ori,
For a list of resources on using Outlook from VB.NET:
http://www.microeye.com/resources/res_outlookvsnet.htm

For help & information on programming Outlook (mostly VB6, some VB.NET):
http://www.outlookcode.com/

Some samples of using Outlook with VB.NET:
http://msdn.microsoft.com/office/def...OLOMwVBNET.asp

A sample COM Add-in for Outlook written in VB.NET:
http://msdn.microsoft.com/library/de...hatsNew2k3.asp
Did you check the online help for specifics on using dates with the Find
method?

It needs to be in the following (VBA) format:

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

Remember that you can still use the VBA/VB6 Format function in .NET so it
would be:

sFilter = "[LastModificationTime] > '" & Format(Now, "ddddd h:nn AMPM")
& "'"

or if you prefer (unchecked):

sFilter = "[LastModificationTime] > '" & Now.ToString("ddddd h:nn AMPM")
& "'"

Hope this helps
Jay

"Ori :)" <an*******@discussions.microsoft.com> wrote in message
news:4F**********************************@microsof t.com...
I am writing an application to retrieve appointments from Outlook, I have the appointment items sorted by "Start" field and now I want to find the first record which's "Start" value is later than now (future appointment)
The relevant piece of my current code:

Dim oCalendar As Outlook.MAPIFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFo lderCalendar) Dim oItems As Outlook.Items = oCalendar.Items
oItems.Sort("Start")
oItems.IncludeRecurrences = True
Dim oAppt As Outlook.AppointmentItem = oItems.Find("[Subject] = ""Flight, CO 0516 2:10pm""")
What is the syntax to replcae the ("[Subject] = ""Flight, CO 0516 2:10pm""") in the last line to reflect what I need ? something like ".Find("[Start] >" & Now.ToString)" - which does not work

Your help is greatly appriciated
Thanks !
Ori :)

Nov 20 '05 #2

P: n/a
Thanks Jay ! will give it a try ! :)
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.