Email address of the current user

  • Thread starter Thread starter cookiesncreamychoc
  • Start date Start date
C

cookiesncreamychoc

Hi Ppl,

I need to retrieve the email address of the current user from an
Appointment item using VB.NET (VS 05) via an add-in.
From what is already out there,
1. Session.CurrentUser may return the SMTP address or the distinguished
name. Which setting on the Exchange server determines what it returns
plz? (Cannot use LDAP as the user may not always be connected to the
Internet/Intranet)
2. In the above scenario, there may or may not be a security message
box. What determines the pop up of this box?
3. Use CDO. There are examples for using it with MailItem. Is it
possible with an Appointment Item?
4. Any alternate solution?

Thnx
 
1. No such setting. If the Exchange provider is responsible for the user
identity in the profile, you will always get an EX type address. You *can*
retrieve the SMTP address(es) from an EX address entry.
2. Version of Outlook and the API that uou are using - see
http://www.outlookcode.com/d/sec.htm
3. Yes. To do what?
4. Solution to always retrieving an SMTP address? You will need to use
Extended MAPI, CDO 1.21 or Redemption (no OOM) to retrieve either teh
PR_SMTP_ADDRESS property (may not be available in the cached mode) or
PR_EMS_AB_PROXY_ADDRESSES property.
<plug>
Redemption (url below) exposes SMTPAddress property on the address entries:
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT 'Outlook 2002 and up
MsgBox Session.CurrentUser.SMTPAddress
</plug>

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

1. I CAN retrieve the SMTP address(es) from an EX address
entry...really ...How?
3. To retrieve the current user's SMTP address from Appointment form.
4. Extended MAPI, CDO 1.21 - any examples for C# or VB.Net plz?

TIA
 
1. See #4
2. But the current user's e-mail address has nothing to do with a given
appointment, does it not?
3. You cannot access Extended MAPI from .Net, at least MS does not support
that. There is a MAPI33 library that allows to use Extended MAPi from .Net
languages (I thing VB.Net only, but not C#), but if you never tried Extended
MAPI, don't expect this to be an easy one afternoon project. In CDO 1.21 you
will need to access Session.CurrentUser property, then use
AddressEntry.Fields() to read the PR_SMTP_ADDRESS or
PR_EMS_AB_PROXY_ADDRESSES property. See
http://www.outlookcode.com/d/code/getsenderaddy.htm for an example that
reads a sender SMTP address.

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