Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Please translate VB code that uses MAPI to C#
Hello C# gurus out there,

I'm starting to learn C# from scratch and really need help.  I just
need 2 lines in this code translated to C#.  Here is a piece of code
that works in VB.NET:

This code looks up an email message and finds the sender's address:

Dim objSession As MAPI.Session
Dim objCDOMsg As MAPI.Message
Const g_PR_SMTP_ADDRESS_W = &H39FE001F  ' C# Syntax for this?

objSession = CreateObject("MAPI.Session")
objSession.Logon("", "", False, False)

' pass message to CDO
objCDOMsg = objSession.GetMessage(SomeID)
' get sender address
Dim strAddress As String
strAddress = objCDOMsg.Sender.Fields(g_PR_SMTP_ADDRESS_W).value 'C#
syntax?
MsgBox (strAddress)

Thanks in advance for your help!

Tanya

Report this thread to moderator Post Follow-up to this message
Old Post
Tanya
11-16-04 11:54 PM


Re: Please translate VB code that uses MAPI to C#
I got it to work!

vndaxanh@yahoo.com (Tanya) wrote in message news:<3c5e8dab.0411091432.7dfa8056@posting.goog
le.com>...
> Hello C# gurus out there,
>
> I'm starting to learn C# from scratch and really need help.  I just
> need 2 lines in this code translated to C#.  Here is a piece of code
> that works in VB.NET:
>
> This code looks up an email message and finds the sender's address:
>
>    Dim objSession As MAPI.Session
>    Dim objCDOMsg As MAPI.Message
>    Const g_PR_SMTP_ADDRESS_W = &H39FE001F  ' C# Syntax for this?
>
>    objSession = CreateObject("MAPI.Session")
>    objSession.Logon("", "", False, False)
>
>    ' pass message to CDO
>    objCDOMsg = objSession.GetMessage(SomeID)
>    ' get sender address
>    Dim strAddress As String
>    strAddress = objCDOMsg.Sender.Fields(g_PR_SMTP_ADDRESS_W).value 'C#
> syntax?
>    MsgBox (strAddress)
>
> Thanks in advance for your help!
>
> Tanya

Report this thread to moderator Post Follow-up to this message
Old Post
Tanya
11-16-04 11:54 PM


Re: Please translate VB code that uses MAPI to C#
Hi there,
Here is ur code in c#.
//////////////////////////////////
public MAPI.Session objSession;
public MAPI.Message objCDOMsg;
const float g_PR_SMTP_ADDRESS_W = 0X39FE001;
// C# Syntax for this?
objSession = Microsoft.VisualBasic.Interaction.CreateObject("MAPI.Session");
objSession.Logon("", "", false, false);
// pass message to CDO
objCDOMsg = objSession.GetMessage(SomeID);
// get sender address
string strAddress = "";
strAddress = objCDOMsg.Sender.Fields(g_PR_SMTP_ADDRESS_W).value;
//C# syntax?
MessageBox.Show(strAddress);
///////////////////////////////////

vndaxanh@yahoo.com (Tanya) wrote in message news:<3c5e8dab.0411100928.5411c8cf@posting.goog
le.com>...
> I got it to work!
>
> vndaxanh@yahoo.com (Tanya) wrote in message news:<3c5e8dab.0411091432.7dfa
8056@posting.google.com>... 

Report this thread to moderator Post Follow-up to this message
Old Post
azam
11-16-04 11:54 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

C# archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:50 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.