Search Folder for Internal Mail

S

Stars

I've asked about this on the MS Group, got a reply, but the
information didn't help. I want a search folder that finds all
unopened mail in the inbox but excludes external mail. I've added the
conditions to exclude @ and <> in the sender's address, but it still
finds the external mail. I've rearranged this rule many times and I
left out the @ which was recommended, but external mail is still
found.

We just came off of GroupWise where the same conditions were used and
the search folder worked. This folder is for one of our executives
that can get up to 800 messages a day. He needs assistance in finding
his internal mail. Any help with this would be greatly appreciated!
 
K

Ken Slovak - [MVP - Outlook]

The only way to do that would be to write code to create the search folder.
The search folder filter dialog isn't capable enough to do that. The search
condition you would need would be something like the following:

"urn:schemas:httpmail:fromname" LIKE '%/cn=%' AND
"urn:schemas:httpmail:read" = 0

That would check for unread emails from inside the Exchange domain, looking
for "/cn" anywhere in the from to check for an X400 address.

The code to create that folder would look something like this, adjust the
mailbox name and any other strings you want:

Sub InternalEmailSearchFolder()
Dim sch As Outlook.Search
Dim strF As String
Dim strS As String
Dim strTag As String

strF = Chr(34) & "urn:schemas:httpmail:fromname" & Chr(34) & " LIKE
'%/cn=%'"


strF = strF & " AND " & Chr(34) & "urn:schemas:httpmail:read" & Chr(34) &
" = 0"

strS = "'//Mailbox - Ken Slovak'"
strTag = "Search1234"

Set sch = Application.AdvancedSearch(Scope:=strS, Filter:=strF, _
SearchSubFolders:=True, Tag:=strTag)

sch.Save ("Unread Internal")
Set sch = Nothing
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top