Dim olmi As Outlook.MailItem
Dim olrs As Outlook.Recipients
Dim olR as Outlook.Recipient
strE = email address I am looking for
For Each olmi In olFolder.Items 'look at every message in folder
Set olrs = olmi.Recipients
For Each olR In olrs
'check every recipient the message was sent to
If olR.Address = strE And olmi.SenderEmailAddress <> olR.Address
Then
[code omitted]
Next
'check sender address
If strFn <> "Sent Items" And olmi.SenderEmailAddress = strE Then
[code omitted]
End If
Next olmi
What property can I inspect to check to see if a message is digitally signed
or encrypted? Or is it possible to automate Outlook in some way so I don't
have to use this loop, but rather use Outlook's own search capabilities?
Thanks in advance.
It appears that you cannot automate the Advanced Find feature. And I doubt
there is anything that can be done with VBA to inspect a digitally signed or
encrypted message. More functionality sacrificed on the altar of
security...
http://support.microsoft.com/default.aspx?scid=kb;EN-US;170783
Q: How can I programmatically search for items and folders based on the
contents of a field?
A: You cannot programmatically use the Find or Advanced Find features in
Outlook, but you can use the Find method in the Outlook object model to
retrieve a single item based on the contents of one or more fields. You can
also use the Restrict method to retrieve a set of items that match certain
criteria. For additional information about how to use the Find and Restrict
methods, click the article numbers below to view the articles in the
Microsoft Knowledge Base:
171115 OL97: How to Use the Restrict Method 174476 OL97: How to Use
Variables with Find and Restrict Filters
Still looking for a way to test if a message is digitally signed or not...
You can program the equivalent of AdvancedSearch if you are using Outlook
2002 or later using the Application.AdvancedSearch method.
You are better off posting programming questions in a group like
microsoft.public.outlook.program_vba, where the developers hang out.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"deko" <nos...@hotmail.com> wrote in message
news:9qlxc.68407$7w2....@newssvr29.news.prodigy.com...
I looked at that KB article - it was helpful, but shows how to do it with an
Exchange server, rahter than with local PST folders (which is what I'm
using). I assume I can use CDO with local PSTs, so I'm working on this now,
and have posted to the microsoft.public.outlook.program_vba newsgroup as you
suggested.
> You can program the equivalent of AdvancedSearch if you are using Outlook
> 2002 or later using the Application.AdvancedSearch method.
That sounds interesting. I'm guessing that would be quicker than looping
through and inspecting porperties with VBA as I am donig now. But would
results only be returned in the Outhlok interface? I'm trying to populate
an Access table with message header info like sender. recipient, subject,
date sent, etc.
Thanks for the help.
The results of the AdvancedSearch method isn't displayed in the UI. You can
get the results using code however. That method returns a Search object and
the Search object's Results collection can be iterated to get data from each
item in Results. It's definitely quicker than looping over an Items
collection and can be used to search in more than one folder.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"deko" <nos...@hotmail.com> wrote in message
news:L9Kxc.82377$aR3....@newssvr25.news.prodigy.com...
Hi and thanks for the reply. I have looked at Redemption, but would like to
avoid adding additional complexity to my app. Being able to circumvent the
annoying security prompt is a bit plus, however.
> The results of the AdvancedSearch method isn't displayed in the UI. You
can
> get the results using code however. That method returns a Search object
and
> the Search object's Results collection can be iterated to get data from
each
> item in Results. It's definitely quicker than looping over an Items
> collection and can be used to search in more than one folder.
That sounds like what I'm looking for. I found this KB article -
http://support.microsoft.com/?kbid=307922
"How to Use the Query Builder for View Filters and Advanced Searches" - is
this the kind of thing you are referring to? What I want to do is search
all messages (including digitally signed and encrypted messages) in local
PSTs (including user-defined PSTs) for stuff like sender and recipient email
addresses, subject line, date sent/received - and populate an Access table
with the results. The problem I ran into with VBA and the standard Outlook
object model was that I could not inspect the properties of
encrypted/digitally signed messages. Also, Speed was not that great. I am
hoping I can find a way to solve both the speed issue and the encrypted
message problem using the Advanced Search method. If you can point me to
any code samples, that would be great. I am using Outlook 2003, by the way.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"deko" <nos...@hotmail.com> wrote in message
news:J74yc.83170$G_5....@newssvr25.news.prodigy.com...