A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Outlook Macro to get Exchange Info from Mail



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 13th 10, 11:31 AM posted to microsoft.public.outlook.program_vba
_M_a_t_t_
external usenet poster
 
Posts: 1
Default Outlook Macro to get Exchange Info from Mail

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
Ads
  #2  
Old April 13th 10, 03:56 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook Macro to get Exchange Info from Mail

You can get the Exchange Global Address List as a member of the
Outlook.AddressLists collection.

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_" wrote in message
...
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


  #3  
Old April 14th 10, 09:27 AM posted to microsoft.public.outlook.program_vba
_M_a_t_t_[_2_]
external usenet poster
 
Posts: 12
Default Outlook Macro to get Exchange Info from Mail

Thanks for the answer Ken.

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.

"Ken Slovak - [MVP - Outlook]" wrote:

You can get the Exchange Global Address List as a member of the
Outlook.AddressLists collection.

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_" wrote in message
...
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


.

  #4  
Old April 14th 10, 08:45 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook Macro to get Exchange Info from Mail

For MAPI you'd need to use the IAddressBook interface, but I'm not a MAPI
programmer so you can see if Dmitry sees this, start another thread that
might catch his attention, or post in
microsoft.public.win32.programmer.messaging (which is a group for MAPI
programmers).

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_" wrote in message
...
Thanks for the answer Ken.

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.


  #5  
Old April 15th 10, 08:20 AM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Outlook Macro to get Exchange Info from Mail

So d oyo uwant to access EX specific properties of a contact that was create
in the hContacts folder from one of the GAL entries?
Or EX properties of a message sender/recipient?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"_M_a_t_t_" wrote in message
...
Thanks for the answer Ken.

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.

"Ken Slovak - [MVP - Outlook]" wrote:

You can get the Exchange Global Address List as a member of the
Outlook.AddressLists collection.

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_" wrote in message
...
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


.



  #6  
Old April 16th 10, 08:38 AM posted to microsoft.public.outlook.program_vba
_M_a_t_t_[_2_]
external usenet poster
 
Posts: 12
Default Outlook Macro to get Exchange Info from Mail

The contact does not exist in the local address book. What I want to access
is the contact information you can access when right clicking on From name
and choosing Outlook Properties. With non exchange senders, you Display
name, E-mail address, E-mail type, and Internet format. When its an Exchange
mail, you get (provided entered), shipping address, phone number(s), country
etc. Its this information I'd like to access directly from the Email (as the
contact isn't in the local address book, and I'm reading in, parcing and
displaying information from the email). However, I can not install additional
plug-ins. I need to be able to do this with what Outlook already has. I'm
assuming this can be done with Microsoft CDO 1.21 Reference and/or MAPI, but
I need an example of how to access the information from the email and contact
in 1 loop (or perhaps via a sub function called from the main loop. Again I'm
currently using this formation to read out the information from the Email:

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" wrote:

So d oyo uwant to access EX specific properties of a contact that was create
in the hContacts folder from one of the GAL entries?
Or EX properties of a message sender/recipient?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-


  #7  
Old April 20th 10, 12:06 PM posted to microsoft.public.outlook.program_vba
_M_a_t_t_[_2_]
external usenet poster
 
Posts: 12
Default Outlook Macro to get Exchange Info from Mail

Any chance of an update on this? I have not been ale to find any information
on the Web or in the Help file....
  #8  
Old April 20th 10, 07:15 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Outlook Macro to get Exchange Info from Mail



--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"_M_a_t_t_" wrote in message
...
The contact does not exist in the local address book. What I want to
access
is the contact information you can access when right clicking on From name
and choosing Outlook Properties. With non exchange senders, you Display
name, E-mail address, E-mail type, and Internet format. When its an
Exchange
mail, you get (provided entered), shipping address, phone number(s),
country
etc. Its this information I'd like to access directly from the Email (as
the
contact isn't in the local address book, and I'm reading in, parcing and
displaying information from the email). However, I can not install
additional
plug-ins. I need to be able to do this with what Outlook already has. I'm
assuming this can be done with Microsoft CDO 1.21 Reference and/or MAPI,
but
I need an example of how to access the information from the email and
contact
in 1 loop (or perhaps via a sub function called from the main loop. Again
I'm
currently using this formation to read out the information from the Email:

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" wrote:

So d oyo uwant to access EX specific properties of a contact that was
create
in the hContacts folder from one of the GAL entries?
Or EX properties of a message sender/recipient?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-




  #9  
Old April 20th 10, 07:39 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Outlook Macro to get Exchange Info from Mail

Create an instance of the MAPI.Session object,
set Session.MAPIOBJECT property to Namespace.MAPIOBJECT from OOM
Reopen the message in CDO 1.21 using Session.GetMessage and the valeu of teh
MailItem.EntryID
Read the Message.Sender property (returnsd AddressEntry).
Use AddressEntry.Fields[] to access the required propeties - you can get the
props tags from OutlookSpy (e.g. click IMAPISession | QueryIdentity)

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"_M_a_t_t_" wrote in message
...
The contact does not exist in the local address book. What I want to
access
is the contact information you can access when right clicking on From name
and choosing Outlook Properties. With non exchange senders, you Display
name, E-mail address, E-mail type, and Internet format. When its an
Exchange
mail, you get (provided entered), shipping address, phone number(s),
country
etc. Its this information I'd like to access directly from the Email (as
the
contact isn't in the local address book, and I'm reading in, parcing and
displaying information from the email). However, I can not install
additional
plug-ins. I need to be able to do this with what Outlook already has. I'm
assuming this can be done with Microsoft CDO 1.21 Reference and/or MAPI,
but
I need an example of how to access the information from the email and
contact
in 1 loop (or perhaps via a sub function called from the main loop. Again
I'm
currently using this formation to read out the information from the Email:

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" wrote:

So d oyo uwant to access EX specific properties of a contact that was
create
in the hContacts folder from one of the GAL entries?
Or EX properties of a message sender/recipient?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-




  #10  
Old April 21st 10, 06:40 AM posted to microsoft.public.outlook.program_vba
_M_a_t_t_[_2_]
external usenet poster
 
Posts: 12
Default Outlook Macro to get Exchange Info from Mail

Thanks for the update Dmitry, however I do not understand what you are
refering to nor how to do what you have stated (I say that I need an example
previously) ..... Any chance you can post a small example?

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook Contacts Macro to Change Info Jason Outlook and VBA 1 November 14th 08 12:57 AM
Macro to rename Subject of E-mail on exchange server(2007) Ryan Arnold Outlook and VBA 4 October 6th 08 04:30 AM
outlook 2003 macro to extract calendar appointment info to Excel CPOjoe Outlook - Calandaring 3 July 15th 08 05:04 PM
retrieving Outlook user info from Word macro IndianSummer Outlook and VBA 1 September 29th 07 01:05 AM
Importing Outlook Alias info into an excel 2003 macro fidgitthedigit Outlook and VBA 4 May 31st 06 05:22 PM


All times are GMT +1. The time now is 04:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.