2011 Feb 11 10:51 AM
Hi everyone,
I'm using the Application.AdvancedSearch objekt to search for a string in the Outlook folder "Inbox'.
I' having trouble passing the filter parameter. With a pair of Concatenate instructions I've built it up in order to pass it in the precise characters chain (see Microsoft reference for Application.AdvancedSearch Method :http://msdn.microsoft.com/en-us/library/bb219884.aspx)
I've already testet that it works without passing the filter parameter, or with an empty filter paramenter. Only by passing it it doesn't work any more, and I don't know if it depends on the passed string (which anyhow by debugging totally corresponds to the string in the microsoft reference).
It would be greatful if anyone has an idea about it.
Here my code: by the way, I testet with both of the Methods : 'ci_phrasematch' and 'like' , without success.
with 'ci_phrasematch':
lv_filter = 'Chr(34) & "urn:schemas:httpmail:subject" & Chr(34) & " ci_phrasematch' .
concatenate lv_filter '''' into lv_filter SEPARATED BY space.
concatenate lv_filter 'Hallo' '''' '"' INTO lv_filter.
with 'like'
lv_filter = 'Chr(34) & "urn:schemas:httpmail:subject" & Chr(34) & " like' .
concatenate lv_filter '''' into lv_filter SEPARATED BY space.
concatenate lv_filter '%Hallo%' '''' '"' INTO lv_filter.
CALL METHOD OF OUT 'ADVANCEDSEARCH' = SEARCH EXPORTING #1 = 'Inbox' #2 = LV_FILTER ."#3 = 'True' #4 = 'MySearch'.
Thank you,
Christian
2011 Feb 11 2:40 PM
Hi,
Chr(34) in examples from Microsoft stands for ASCII 34 - double quote. You shouldn't concatenate it in ABAP literally.
It works just fine:
INCLUDE ole2incl.
DATA outlook TYPE ole2_object.
DATA search TYPE ole2_object.
DATA results TYPE ole2_object.
DATA count TYPE i.
DATA filter TYPE string.
DATA scope TYPE string.
CREATE OBJECT outlook 'Outlook.Application'.
check sy-subrc = 0.
filter = '"urn:schemas:httpmail:subject" like ''%Test%'''.
scope = '''Inbox'''.
CALL METHOD OF
outlook
'AdvancedSearch' = search
EXPORTING
#1 = scope
#2 = filter
#3 = 'False'.
check sy-subrc = 0.
GET PROPERTY OF search 'Results' = results.
check sy-subrc = 0.
GET PROPERTY OF results 'Count' = count.
check sy-subrc = 0.
WRITE count.
2011 Feb 11 2:40 PM
Hi,
Chr(34) in examples from Microsoft stands for ASCII 34 - double quote. You shouldn't concatenate it in ABAP literally.
It works just fine:
INCLUDE ole2incl.
DATA outlook TYPE ole2_object.
DATA search TYPE ole2_object.
DATA results TYPE ole2_object.
DATA count TYPE i.
DATA filter TYPE string.
DATA scope TYPE string.
CREATE OBJECT outlook 'Outlook.Application'.
check sy-subrc = 0.
filter = '"urn:schemas:httpmail:subject" like ''%Test%'''.
scope = '''Inbox'''.
CALL METHOD OF
outlook
'AdvancedSearch' = search
EXPORTING
#1 = scope
#2 = filter
#3 = 'False'.
check sy-subrc = 0.
GET PROPERTY OF search 'Results' = results.
check sy-subrc = 0.
GET PROPERTY OF results 'Count' = count.
check sy-subrc = 0.
WRITE count.
2015 Dec 09 1:35 PM
Hi,
I am practically doing the same thing as you have shown here, but somehow the AdvancedSearch method is never called.
I have tried with several possibilities like
Do you think I am missing anything here?