You then would have to find the AddressEntry that corresponds to the
sender's AddressEntry in the GAL. From there you could get some of the
property you refer to, just what's exposed for an AddressEntry.
You pretty much would have to iterate the AddressEntries collection in the
GAL AddressList to find one where the name matched the AddressEntry.Name
property.
What is exposed for an AddressEntry does not include telephone numbers,
country, mailing address or a lot of other things. For those properties you
would need to use other methods such as Extended MAPI or Redemption
(www.dimastr.com/redemption) or CDO 1.21 or even LDAP queries.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"_M_a_t_t_" <_M_a_...@discussions.microsoft.com> wrote in message
news:277E54C4-966B-42B0...@microsoft.com...
> Hi, I'm working on a macro in Outlook 2003 SP3 that, when started,
> displays
> an Email in a custom dialog, broken down into elements. The dialog is used
> for Email processing. Upgrading Outlook is not possible, and adding addons
> is
> also not possible (other then what is currently installed).
>
> What I'm looking to achieve is, when an Email is from Exchange (company
> email), to display the information found when you right click on the
> senders
> name and choose 'Outlook Properties'. Things displayed here, are, for
> example, the address, country & telephone number. The sender is not in the
> contacts in Outlook. I want to get the contact information from the Email.
>
> I'm accessing the information from the Email with something like this (I
> have seen that MAPI can be used, but I have not found an example that work
> like this, if someone can correct me here, I'd be greatful):
>
> Dim olkItem As Outlook.MailItem
>
> For Each olkItem In Application.ActiveExplorer.Selection
>
> 'Read the info and enter it into the dialog
>
> 'Example info: MsgBox olkItem.SenderEmailAddress
>
> Next
>
> How can I access the Exchange information from the mail item? I hope I
> have
> explained this clearly enough.
>
> Thanks for your time.
>
> Office Version:Office 2003 / Operating System:Windows XP
I can not install the redemption Reference, however I do have Microsoft CDO
1.21 Reference. I can also use MAPI. Can you provide an example of how to
access the information I'm refering to using either (or both)?
In the example I posted, I can access all the elements of Outlook.MailItem.
Its the elements of Outlook.ContactItemI'm wanting to access from the Email
only, and I can not find a way nor an example of how to do this. Only on how
to access the information from the contact (Contacts saved in Outlook Address
Book locally) from Outlook.ContactItem via address book.
> .
>
I haven't done any CDO coding in probably almost 8 years, I couldn't help
with that. You might find something relevant at www.cdolive.com, either in
the sample snippets or sample projects. Sig had a lot of valuable stuff
there, but with Redemption I just don't use CDO because of the highly
restricted security environment in client side CDO. Server side CDO is not
restricted in the same way.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"_M_a_t_t_" <Ma...@discussions.microsoft.com> wrote in message
news:7201C3A2-8BA6-4A12...@microsoft.com...
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"_M_a_t_t_" <Ma...@discussions.microsoft.com> wrote in message
news:7201C3A2-8BA6-4A12...@microsoft.com...
Dim olkItem As Outlook.MailItem
For Each olkItem In Application.ActiveExplorer.Selection
'Read the info and enter it into the dialog
'Example info: MsgBox olkItem.SenderEmailAddress
Next
And this works fine (as long as only 1 mail is selected, more then one
causes problems, since each would be processed, but only the last selected
would actually be displayed).
Matt
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"_M_a_t_t_" <Ma...@discussions.microsoft.com> wrote in message
news:43524C5A-3613-4FF6...@microsoft.com...
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"_M_a_t_t_" <Ma...@discussions.microsoft.com> wrote in message
news:43524C5A-3613-4FF6...@microsoft.com...
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
for each Item in Application.ActiveExplorer.Selection
set RDOItem = Session.GetMessagefromID(Item.EntryID)
set Sender = RDOItem.Sender
if not (Sender Is Nothing) Then
MsgBox Sender.City
end if
next
The next script is using CDO 1.21, but I did not have a chance to actually
test it
set Session = CreateObject("MAPI.Session")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
for each Item in Application.ActiveExplorer.Selection
set CDOItem = Session.GetMessage(Item.EntryID)
set Sender = CDOItem.Sender
if not (Sender Is Nothing) Then
MsgBox Sender.City
end if
next
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"_M_a_t_t_" <Ma...@discussions.microsoft.com> wrote in message
news:40D07A3E-9F62-42AF...@microsoft.com...
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"_M_a_t_t_" <Ma...@discussions.microsoft.com> wrote in message
news:6518FD74-EA5D-41EF...@microsoft.com...
Regretfully the help isn't 'helpful' here, since I can't find any
information about this, or what would be 'correct'.....
set temp = Application.Session.MAPIOBJECT
Session.MAPIOBJECT = temp
Is this Access? If, Session intrinsic variable points to an Access object.
Rename the Session variable in the script to somethign like CDOSession.
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"_M_a_t_t_" <Ma...@discussions.microsoft.com> wrote in message
news:B1228788-3D52-4978...@microsoft.com...
Session.MAPIOBJECT = temp
This is the exact code as I have it entered in the the editor:
---------------------------------------------
Sub MailTest()
Set Session = CreateObject("MAPI.Session")
Set temp = Application.Session.MAPIOBJECT
Session.MAPIOBJECT = temp
For Each Item In Application.ActiveExplorer.Selection
Set CDOItem = Session.GetMessage(Item.EntryID)
Set Sender = CDOItem.Sender
If Not (Sender Is Nothing) Then
MsgBox Sender.City
End If
Next
End Sub
---------------------------------------------
I'm trying to get this working on Outlook 2003 (11.8313.8221) SP3.
Is this all explained somewhere in the help file? I can't seem to find
anything (of use) for doing this......
Thanks.
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"_M_a_t_t_" <Ma...@discussions.microsoft.com> wrote in message
news:9BE555C8-4508-44B4...@microsoft.com...
Another words, Outlook VBA (Alt-F11 in Outlook).
PR_LOCALITY = &H3A27001E
Set cdoSession = CreateObject("MAPI.Session")
Set temp = Application.Session.MAPIOBJECT
cdoSession.MAPIOBJECT = temp
For Each Item In Application.ActiveExplorer.Selection
Set CDOItem = cdoSession.GetMessage(Item.EntryID)
Set Sender = CDOItem.Sender
If Not (Sender Is Nothing) Then
Set Field = Sender.Fields.Item(PR_LOCALITY)
If Not (Field Is Nothing) Then
MsgBox Field.Value
End If
End If
Next
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"_M_a_t_t_" <Ma...@discussions.microsoft.com> wrote in message
news:482BD9B7-9BCA-4F47...@microsoft.com...
When I run the code you posted above I get:
Compile error:
Assignment to constant not permitted
on this line:
Set CdoSession = CreateObject("MAPI.Session")
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"_M_a_t_t_" <Ma...@discussions.microsoft.com> wrote in message
news:7F8668BC-7890-4214...@microsoft.com...
> Try setting a reference to CDO.DLL in the references for your VBA project.
I have this already:
Microsoft CDO 1.21 Library
C:\Program Files\Common Files\System\MSMAPI\1033\CDO.DLL
I'm starting to think this isn't possible......
> Try setting a reference to CDO.DLL in the references for your VBA project.
I have this already:
Microsoft CDO 1.21 Library
C:\Program Files\Common Files\System\MSMAPI\1033\CDO.DLL
I'm starting to think this isn't possible.......
> Try setting a reference to CDO.DLL in the references for your VBA project.
Adding Option Explicit to the head of the Module, and then Diming each
variable finally got results. Wish someone had mentioned this....
This now brings me to my next two questions:
1. How to go though each element and not cause an error message to be
displayed when nothing is there (for example if
CdoPR_BUSINESS_ADDRESS_POSTAL_CODE is empty, I get an error that allows me to
End or Debug. I'd like to skip this, and just leave it empty)?
2. How to desable to prompt from Outlook asking if I want to allow the macro
to access:
A program is trying to access e-mail addresses you have stored in Outlook.
Do you want to allow this?
I can only allow 1, 2, 5 & 10 Minutes. But not an always allow. I have
digitally signed the macros, and all work without prompting until CDO is
accessed, then the prompt appears.
For 2 that's the reason most of stopped using CDO many years ago, the
security. Client side CDO actually has tighter security than the Outlook
object model (server side CDO has none of the security but should not be
installed where Outlook is installed). There are hacks and kludges such as
ExpressClickYes, but I'd rather not use things like that. As a substitute
for CDO most of us have moved on to using Redemption.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"_M_a_t_t_" <Ma...@discussions.microsoft.com> wrote in message
news:4A495EFD-77D9-4343...@microsoft.com...