By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,084 Members | 1,969 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,084 IT Pros & Developers. It's quick & easy.

CDO.Message.DataSource.Open() in .NET

P: n/a
Hi folks! :O)

I need to take a email from a given mailbox and forward it to another
mailbox.

The code we had in VB 6 looked like this one :
'***
Dim objMsg As Object
Dim objFwd As Object

' get the mail we need to forward
Set objMsg = CreateObject("CDO.Message")
objMsg.DataSource.Open strMsgAddr, , 3, , , strUsername, strPassword

' create the forward mail, update the addresses
' and sends the mail
Set objFwd = objMsg.Forward
objFwd.To = strToAddr
objFwd.From = strFromAddr
objFwd.send
'***

since i need to convert this code into VB.NET code, I was wondering if CDO
was still the way to go ?

also, how would .NET (via CreateObject()) handles late-binding ? does it
create an interop-wrapper assembly at runtime ? is it slower than it was
before the "managed Era"...
and finally I's like to wish a Happy New Year to all you !! :OD

--
Best Regards
Yanick
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
The SMTPMail class in the 1.1 framework is just a wrapper over CDO. There
is no reason not to simply continue to use CDO directly, especially since
your code does things that the wrapper doesn't let you get to. It won't be
any slower in the managed space. I don't see any reason to do late binding,
though. You can reference the CDO objects at design time and .Net will
create the CCW on the spot for you.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Zoury" <yanick_lefebvre at hotmail dot com> wrote in message
news:ew**************@TK2MSFTNGP14.phx.gbl...
Hi folks! :O)

I need to take a email from a given mailbox and forward it to another
mailbox.

The code we had in VB 6 looked like this one :
'***
Dim objMsg As Object
Dim objFwd As Object

' get the mail we need to forward
Set objMsg = CreateObject("CDO.Message")
objMsg.DataSource.Open strMsgAddr, , 3, , , strUsername, strPassword

' create the forward mail, update the addresses
' and sends the mail
Set objFwd = objMsg.Forward
objFwd.To = strToAddr
objFwd.From = strFromAddr
objFwd.send
'***

since i need to convert this code into VB.NET code, I was wondering if CDO
was still the way to go ?

also, how would .NET (via CreateObject()) handles late-binding ? does it
create an interop-wrapper assembly at runtime ? is it slower than it was
before the "managed Era"...
and finally I's like to wish a Happy New Year to all you !! :OD

--
Best Regards
Yanick

Nov 21 '05 #2

P: n/a
Hi,

Take a look at the mailmessage class.
http://msdn.microsoft.com/library/de...classtopic.asp

Ken
-----------------
"Zoury" <yanick_lefebvre at hotmail dot com> wrote in message
news:ew**************@TK2MSFTNGP14.phx.gbl...
Hi folks! :O)

I need to take a email from a given mailbox and forward it to another
mailbox.

The code we had in VB 6 looked like this one :
'***
Dim objMsg As Object
Dim objFwd As Object

' get the mail we need to forward
Set objMsg = CreateObject("CDO.Message")
objMsg.DataSource.Open strMsgAddr, , 3, , , strUsername, strPassword

' create the forward mail, update the addresses
' and sends the mail
Set objFwd = objMsg.Forward
objFwd.To = strToAddr
objFwd.From = strFromAddr
objFwd.send
'***

since i need to convert this code into VB.NET code, I was wondering if CDO
was still the way to go ?

also, how would .NET (via CreateObject()) handles late-binding ? does it
create an interop-wrapper assembly at runtime ? is it slower than it was
before the "managed Era"...
and finally I's like to wish a Happy New Year to all you !! :OD

--
Best Regards
Yanick

Nov 21 '05 #3

P: n/a
Hi Ken! :O)

is there something i've missed from this page ? i've looked at it a lot you
know.. ;O)

--
Best Regards
Yanick
"Ken Tucker [MVP]" <vb***@bellsouth.net> a écrit dans le message de
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

Take a look at the mailmessage class.
http://msdn.microsoft.com/library/de...classtopic.asp
Ken
-----------------
"Zoury" <yanick_lefebvre at hotmail dot com> wrote in message
news:ew**************@TK2MSFTNGP14.phx.gbl...
Hi folks! :O)

I need to take a email from a given mailbox and forward it to another
mailbox.

The code we had in VB 6 looked like this one :
'***
Dim objMsg As Object
Dim objFwd As Object

' get the mail we need to forward
Set objMsg = CreateObject("CDO.Message")
objMsg.DataSource.Open strMsgAddr, , 3, , , strUsername, strPassword

' create the forward mail, update the addresses
' and sends the mail
Set objFwd = objMsg.Forward
objFwd.To = strToAddr
objFwd.From = strFromAddr
objFwd.send
'***

since i need to convert this code into VB.NET code, I was wondering if CDO
was still the way to go ?

also, how would .NET (via CreateObject()) handles late-binding ? does it
create an interop-wrapper assembly at runtime ? is it slower than it was
before the "managed Era"...
and finally I's like to wish a Happy New Year to all you !! :OD

--
Best Regards
Yanick

Nov 21 '05 #4

P: n/a
Hi Nick!
The SMTPMail class in the 1.1 framework is just a wrapper over CDO.
Yeah I know. I've got 2 different CDO Libraries here CDO 1.21 and CDOEX...
do you happen to know which one was wrapped ? is CDO 1.21 library an
obsolete version ?

I don't see any reason to do late binding,
though. You can reference the CDO objects at design time and .Net will
create the CCW on the spot for you.


i guess they used late-binding to support further versions of CDO or to
avoid DLL hell somehow... ;O)
Thanks for your input!

--
Best Regards
Yanick
Nov 21 '05 #5

P: n/a
Hi,

Sorry should have sent a link to the smtpmail class instead. It is
a managed wrapper for using cdo.

http://msdn.microsoft.com/library/de...classtopic.asp

Example.

http://support.microsoft.com/default...&Product=vbNET

Ken
-------------------
"Zoury" <yanick_lefebvre at hotmail dot com> wrote in message
news:un**************@TK2MSFTNGP15.phx.gbl...
Hi Ken! :O)

is there something i've missed from this page ? i've looked at it a lot you
know.. ;O)

--
Best Regards
Yanick
"Ken Tucker [MVP]" <vb***@bellsouth.net> a écrit dans le message de
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

Take a look at the mailmessage class.
http://msdn.microsoft.com/library/de...classtopic.asp
Ken
-----------------
"Zoury" <yanick_lefebvre at hotmail dot com> wrote in message
news:ew**************@TK2MSFTNGP14.phx.gbl...
Hi folks! :O)

I need to take a email from a given mailbox and forward it to another
mailbox.

The code we had in VB 6 looked like this one :
'***
Dim objMsg As Object
Dim objFwd As Object

' get the mail we need to forward
Set objMsg = CreateObject("CDO.Message")
objMsg.DataSource.Open strMsgAddr, , 3, , , strUsername, strPassword

' create the forward mail, update the addresses
' and sends the mail
Set objFwd = objMsg.Forward
objFwd.To = strToAddr
objFwd.From = strFromAddr
objFwd.send
'***

since i need to convert this code into VB.NET code, I was wondering if CDO
was still the way to go ?

also, how would .NET (via CreateObject()) handles late-binding ? does it
create an interop-wrapper assembly at runtime ? is it slower than it was
before the "managed Era"...
and finally I's like to wish a Happy New Year to all you !! :OD

--
Best Regards
Yanick


Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.