How to get Exchange/SMTP address from 'Distinguish Name' from Outlook mail Item

  • Thread starter Dattatraya Shewale
  • Start date
D

Dattatraya Shewale

Hi All
I have developed a COM Add-Ins for outlook in .NET.
Currently I am facing problem in getting the actual
qulified e-mail address if the outlook is configured with
Exchange Server enviornment. The address entry contains
some text like '/o=Compny name/ou=First Administrative
Group/cn=Recipients/cn=dshewale' and not the actual
address for the recipient. The solutions on different
forum uses CDO/MAPI, but I want that to be done in .NET.
Please help me out of this with useful pointers.
Thanking in advance.

Thanks
Dattatraya
 
D

Dattatraya Shewale

Hi
Thanks for the reply, I had gone through the sample
code you have refered but my problem is how I will do that
in C#. I am unable to create the object for MAPI.Session,
when the code line-> objSession = new MAPI.SessionClass
();' get executed then the exception is raised saying 'New
thread can not be set to the Exisiting one'. So please can
you tell me how to create the Session object in C#? It
will be helpful for me.

Thanks
Dattatraya
 
G

Guest

Hi,
Here it is the code I am trying which is in C#

Outlook.Recipient l_oRec;

//For this line it gives error, it doesn't create session,
MAPI.Session l_oSession = new MAPI.Session();
l_oSession.Logon(System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,false,
System.Reflection.Missing.Value,System.Reflection.Missing.V
alue,System.Reflection.Missing.Value);

l_oRec = CurrentMailItem.Recipients.Item(l_nIndex);
MAPI.AddressEntry l_oMEntry = (MAPI.AddressEntry)
l_oSession.GetAddressEntry(l_oRec.AddressEntry.ID);
MAPI.Fields loFileds = (MAPI.Fields)loMEntry.Fields;
MAPI.Field l_oFiled = (MAPI.Field)loFileds
[PR_SMTP_ADDRESS];


Thanks
Dattatraya
 
D

Dmitry Streblechenko \(MVP\)

Interesting... You have CDO 1.21 installed, right? Can you create an
instance of MAPI.Session in VB6 on the same machine?

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


Hi,
Here it is the code I am trying which is in C#

Outlook.Recipient l_oRec;

//For this line it gives error, it doesn't create session,
MAPI.Session l_oSession = new MAPI.Session();
l_oSession.Logon(System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,false,
System.Reflection.Missing.Value,System.Reflection.Missing.V
alue,System.Reflection.Missing.Value);

l_oRec = CurrentMailItem.Recipients.Item(l_nIndex);
MAPI.AddressEntry l_oMEntry = (MAPI.AddressEntry)
l_oSession.GetAddressEntry(l_oRec.AddressEntry.ID);
MAPI.Fields loFileds = (MAPI.Fields)loMEntry.Fields;
MAPI.Field l_oFiled = (MAPI.Field)loFileds
[PR_SMTP_ADDRESS];


Thanks
Dattatraya
-----Original Message-----
Please post more of your code.

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





.
 
D

Dattatraya Shewale

Hi,
I can create the object in VB 6 but when I access the
Recipient property of mail Item it gives me error : Access
denied.

Thanks
Datta
-----Original Message-----
Interesting... You have CDO 1.21 installed, right? Can you create an
instance of MAPI.Session in VB6 on the same machine?

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


Hi,
Here it is the code I am trying which is in C#

Outlook.Recipient l_oRec;

//For this line it gives error, it doesn't create session,
MAPI.Session l_oSession = new MAPI.Session();
l_oSession.Logon(System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,false,
System.Reflection.Missing.Value,System.Reflection.Missing.V
alue,System.Reflection.Missing.Value);

l_oRec = CurrentMailItem.Recipients.Item(l_nIndex);
MAPI.AddressEntry l_oMEntry = (MAPI.AddressEntry)
l_oSession.GetAddressEntry(l_oRec.AddressEntry.ID);
MAPI.Fields loFileds = (MAPI.Fields)loMEntry.Fields;
MAPI.Field l_oFiled = (MAPI.Field)loFileds
[PR_SMTP_ADDRESS];


Thanks
Dattatraya
-----Original Message-----
Please post more of your code.

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


Hi
Thanks for the reply, I had gone through the sample
code you have refered but my problem is how I will do that
in C#. I am unable to create the object for MAPI.Session,
when the code line-> objSession = new MAPI.SessionClass
();' get executed then the exception is raised saying 'New
thread can not be set to the Exisiting one'. So
please
can
you tell me how to create the Session object in C#? It
will be helpful for me.

Thanks
Dattatraya

-----Original Message-----
You need to read the PR_SMTP_ADDRESS property using
Extended MAPI, CDO 1.21
or Redemption.
See http://www.outlookcode.com/threads.aspx?
forumid=1&messageid=597 for an
example

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


message
Hi All
I have developed a COM Add-Ins for outlook in .NET.
Currently I am facing problem in getting the actual
qulified e-mail address if the outlook is configured
with
Exchange Server enviornment. The address entry contains
some text like '/o=Compny name/ou=First Administrative
Group/cn=Recipients/cn=dshewale' and not the actual
address for the recipient. The solutions on different
forum uses CDO/MAPI, but I want that to be done in .NET.
Please help me out of this with useful pointers.
Thanking in advance.

Thanks
Dattatraya


.



.


.
 
D

Dmitry Streblechenko \(MVP\)

What is the code?

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


Dattatraya Shewale said:
Hi,
I can create the object in VB 6 but when I access the
Recipient property of mail Item it gives me error : Access
denied.

Thanks
Datta
-----Original Message-----
Interesting... You have CDO 1.21 installed, right? Can you create an
instance of MAPI.Session in VB6 on the same machine?

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


Hi,
Here it is the code I am trying which is in C#

Outlook.Recipient l_oRec;

//For this line it gives error, it doesn't create session,
MAPI.Session l_oSession = new MAPI.Session();
l_oSession.Logon(System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,false,
System.Reflection.Missing.Value,System.Reflection.Missing.V
alue,System.Reflection.Missing.Value);

l_oRec = CurrentMailItem.Recipients.Item(l_nIndex);
MAPI.AddressEntry l_oMEntry = (MAPI.AddressEntry)
l_oSession.GetAddressEntry(l_oRec.AddressEntry.ID);
MAPI.Fields loFileds = (MAPI.Fields)loMEntry.Fields;
MAPI.Field l_oFiled = (MAPI.Field)loFileds
[PR_SMTP_ADDRESS];


Thanks
Dattatraya
-----Original Message-----
Please post more of your code.

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


message
Hi
Thanks for the reply, I had gone through the sample
code you have refered but my problem is how I will do
that
in C#. I am unable to create the object for
MAPI.Session,
when the code line-> objSession = new MAPI.SessionClass
();' get executed then the exception is raised
saying 'New
thread can not be set to the Exisiting one'. So please
can
you tell me how to create the Session object in C#? It
will be helpful for me.

Thanks
Dattatraya

-----Original Message-----
You need to read the PR_SMTP_ADDRESS property using
Extended MAPI, CDO 1.21
or Redemption.
See http://www.outlookcode.com/threads.aspx?
forumid=1&messageid=597 for an
example

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


message
Hi All
I have developed a COM Add-Ins for outlook in .NET.
Currently I am facing problem in getting the actual
qulified e-mail address if the outlook is configured
with
Exchange Server enviornment. The address entry
contains
some text like '/o=Compny name/ou=First
Administrative
Group/cn=Recipients/cn=dshewale' and not the actual
address for the recipient. The solutions on different
forum uses CDO/MAPI, but I want that to be done
in .NET.
Please help me out of this with useful pointers.
Thanking in advance.

Thanks
Dattatraya


.



.


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top