T
Tim Pulley
I need to programmatically create a Search Folder in a PST that includes the
PST's root folder. I can create a Search Folder using AdvancedSearch for any
of the PST's subfolders but cannot find folder path string for the root
folder that works.. Using the Outlook UI I can create a Search Folder that
includes the PST's root folder, so it's possible to do this.
Here's the script I'm running in the OutlookSpy Application object's Script
tab.
Dim scope
Dim filter
Dim srchFldrName
Dim srchSubFldrs
Dim srch
Dim srchFldr
scope = "'\\Personal Folders'"
filter = "( http://schemas.microsoft.com/mapi/proptag/0x001A001E Like
'IPM.Post.%' )"
srchSubFldrs = true
srchFldrName = "TSF - " & Now
Debug.Print "Search Folder Name: " + srchFldrName
Set srch = Application.AdvancedSearch( scope, filter, srchSubFldrs,
srchFldrName )
' BrowseObject( srch )
If Not srch is Nothing Then
Set srchFldr = srch.Save( srchFldrName )
End If
If scope is set to just the root folder name, '\\Personal Folders', the call
to create the Search object succeeds but the call to save it fails with the
following error:
Error calling Save()
Return code 0x80020009
The operation failed. An object could not be found.
Using a scope string such as \\Personal Folders\Top of Information Store
causes the call to create the Search object to fail.
Does anyone have any suggestions?
PST's root folder. I can create a Search Folder using AdvancedSearch for any
of the PST's subfolders but cannot find folder path string for the root
folder that works.. Using the Outlook UI I can create a Search Folder that
includes the PST's root folder, so it's possible to do this.
Here's the script I'm running in the OutlookSpy Application object's Script
tab.
Dim scope
Dim filter
Dim srchFldrName
Dim srchSubFldrs
Dim srch
Dim srchFldr
scope = "'\\Personal Folders'"
filter = "( http://schemas.microsoft.com/mapi/proptag/0x001A001E Like
'IPM.Post.%' )"
srchSubFldrs = true
srchFldrName = "TSF - " & Now
Debug.Print "Search Folder Name: " + srchFldrName
Set srch = Application.AdvancedSearch( scope, filter, srchSubFldrs,
srchFldrName )
' BrowseObject( srch )
If Not srch is Nothing Then
Set srchFldr = srch.Save( srchFldrName )
End If
If scope is set to just the root folder name, '\\Personal Folders', the call
to create the Search object succeeds but the call to save it fails with the
following error:
Error calling Save()
Return code 0x80020009
The operation failed. An object could not be found.
Using a scope string such as \\Personal Folders\Top of Information Store
causes the call to create the Search object to fail.
Does anyone have any suggestions?