on 06-29-2015 8:12 AM
Hi all
I will find a subject in the outlook calender. The connect to outlook works but I need help for this:
Who can help me for this.
This is my working code without search
Hope this code is ok!
l_result = ole_outlook.ConnectToNewObject("outlook.application")
ole_namespace = ole_outlook.GetNameSpace("MAPI")
ole_folder = ole_namespace.GetDefaultFolder( olFolderCalendar )
s_name = ole_folder.Name
l_return = ole_folder.items.Count
? dt_Start = ole_folder.Items(o).Start
? ole_folder.start = string( dti_start_datum, 'dd.mm.yyyy' )
for o = 1 to l_return
? l_result = ole_folder.Find("[Subject] = 'My Meeting in city'")
// s_subject = trim(String(ole_folder.Items(o).Subject))
// d_date = date(ole_folder.Items(o).start)
// d_start = datetime(ole_folder.Items(o).start)
// d_end = datetime(ole_folder.Items(o).end)
next
ole_outlook.DisconnectObject()
destroy ole_outlook
return
André Rust
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all
when I add an appointment in Outlook, then is there an ID that I can fall back later?
I will save this ID for delete the appointment in the future.
How can I find the appointment with this ID?
How can I delete the appointment with this ID?
André Rust
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi André,
sorry, I have no powerbuilder example. But it is not difficult to change the VBA code to a powerbuilder code. The example uses the retrict method to find all items in a specific date range. If you only need to specify the start date you can change the filter string.
For more information about the date format see here: Using the Find and Restrict methods to search for dates
Then a different filter is used on the result to filter by subject.
Instead of For-Each-Loop you have to use a FOR-TO-NEXT-Loop from 1 to oFinalItems.Count as in your code.
I have never tried it out, but hope it helps you.
René
Hi René
The problem is that I can do that not with the [Start].
I have done this:
s_start = "[Start] >= '" + string( dti_start_date, 'dd.mm.yyyy hh:mm' )
but as I sat down this value for Outlook?
in ole_namespace
ole_namespace = ole_outlook.GetNameSpace( "MAPI" )
or ole_folder
ole_folder = ole_namespace.GetDefaultFolder( olFolderCalendar )
ole_folder.start = s_start
ole_namespace.start = s_start
ole_folder.item.start= s_start
ole_folder.items.start= s_start
all are crash
André Rust
Look at the example! There are no start properties in that objects.
- Build a find string like s_start (There is a missing ' at the end of the find string!) Maybe you have to use another date format (see the link in my previous posting)
- Use the Restrict method of Items object: ole_range = ole_folder.items.restrict(s_start)
- ole_range conains now a list of the items that match the find
- build a find string for filter by subject
- Use ole_result = ole_range.Retrict(...) to filter
- Loop through result: FOR i = 1 TO ole_result.Count
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.