Thanks for your help.
I've used your suggestions and the following code does now work:
Const PR_EMS_AB_PROXY_ADDRESSES = &H800F101E
Set objOutlook = CreateObject("Outlook.Application")
Set objActiveExplorer = objOutlook.ActiveExplorer
Set objInboxEmail = objActiveExplorer.Selection(1)
Set objSession = CreateObject("MAPI.Session")
objSession.Logon "", "", True, False, 0
strEntryID = objInboxEmail.EntryID
strStoreID = objInboxEmail.Parent.StoreID
Set objCDOMessage = objSession.GetMessage(strEntryID, strStoreID)
Set objAddEntry = objCDOMessage.Sender
If objAddEntry.Type = "EX" Then
Set objField = objAddEntry.Fields(PR_EMS_AB_PROXY_ADDRESSES)
For Each strEmailAddress In objField.Value
If Left(strEmailAddress, 5) = "SMTP:" Then
strAddress = Mid(strEmailAddress, 6)
MsgBox strAddress
Exit For
End If
Next
End If
Problem now is the Outlook security message comes up each time regardless of
the Allow Access for time selected. I know it is normal for it to come up
but normally you can select a time to allow this. Is this a function of the
objSession.Logon? Is there parameters to change this behaviour?
Redemption does seem easier however I would have to roll it out to a few
users first.
Thanks for your help.
Paul
> The messages are different because you are assuming that the item you are
> processing is the last in the folder (objMessages.GetLast). Firstly, the
[quoted text clipped - 71 lines]
> >
> > Thanks for any help.
Dmitry Streblechenko - 02 Nov 2006 18:18 GMT
CDO 1.21 implements is own "Allow Access" dialog, so even if you dismiss the
OOM's dialog, CDO will still show its own one.
You can optimize your code a bit (or a lot) if you only intend to run it in
Outlook 2002 and up: Replace the line
objSession.Logon "", "", True, False, 0
with
objSession.MAPIOBJECT = objOutlook.Session.MAPIOBJECT
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
> Thanks for your help.
>
[quoted text clipped - 117 lines]
>> >
>> > Thanks for any help.