C
Chris O''''Neill
I'm trying to use the AdvancedSearch method to find a contact item using a
user-defined property attached to the item (not the folder). Here's the code
I have so far:
'********* Begin Code***********
Dim olApp As Object
Dim objContact As Object
Dim objContacts As Object
Dim objNameSpace As Object
Dim objProperty As Object
Dim objSearch As Object
Dim objResults As Object
Dim strF1 As String
Dim strS1 As String
Set olApp = CreateObject("Outlook.Application")
Set objNameSpace = olApp.getnamespace("MAPI")
Set objContacts = objNameSpace.GetDefaultFolder(olFolderContacts)
strF1 = "('DAV:isfolder' = false AND 'DAV:ishidden' = false) AND " & _
"('http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/" & _
"BalloonAppID' = '" & strContactID & "')"
strS1 = "*"
Set objSearch = _
olApp.AdvancedSearch(Scope:=strS1, Filter:=strF1,
SearchSubFolders:=True, Tag:="ContactSearch")
'********* End Code***********
When I run this I get the following error:
446: Object doesn't support named arguments
Does this mean that I can't use a variable (strContactID) in AdvancedSearch,
or have I got something else wrong? Also, I'm not sure but I think the
filter string is for the default contact folder field not a user-defined
contact item property.
Any help with this would be VERY much appreciated!
Regards, Chris
user-defined property attached to the item (not the folder). Here's the code
I have so far:
'********* Begin Code***********
Dim olApp As Object
Dim objContact As Object
Dim objContacts As Object
Dim objNameSpace As Object
Dim objProperty As Object
Dim objSearch As Object
Dim objResults As Object
Dim strF1 As String
Dim strS1 As String
Set olApp = CreateObject("Outlook.Application")
Set objNameSpace = olApp.getnamespace("MAPI")
Set objContacts = objNameSpace.GetDefaultFolder(olFolderContacts)
strF1 = "('DAV:isfolder' = false AND 'DAV:ishidden' = false) AND " & _
"('http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/" & _
"BalloonAppID' = '" & strContactID & "')"
strS1 = "*"
Set objSearch = _
olApp.AdvancedSearch(Scope:=strS1, Filter:=strF1,
SearchSubFolders:=True, Tag:="ContactSearch")
'********* End Code***********
When I run this I get the following error:
446: Object doesn't support named arguments
Does this mean that I can't use a variable (strContactID) in AdvancedSearch,
or have I got something else wrong? Also, I'm not sure but I think the
filter string is for the default contact folder field not a user-defined
contact item property.
Any help with this would be VERY much appreciated!
Regards, Chris