473,395 Members | 1,656 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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
5 4920
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Robert Brown | last post by:
Hi All.. This is a strange one that I hope someone has come across. I have an asp.net application that needs to access a flat file databse via ODBC. I have setup the OBDC DSN and tested it...
1
by: Greg Cyrus | last post by:
Hi, i have created a function to open a Databse by OLEDB and fill it into a System.Data.DataSet-Objekt by oleDBAdapter.Fill-Mehtod.. Now I want to assign this DataSet to a normal...
12
by: jburkle | last post by:
Hello all, I am still having an issue where multiple Message Boxes are being displayed to the user from the same form at one time. This issue hides the boxes behind the forms since the forms take...
2
by: scottls | last post by:
Hi All, Thanks for reading my post. I have been working on getting nested datalists working properly wihtin my framework for many days and I think I'm almost there. See if you could help me...
0
by: Gene | last post by:
In Win application you can select an Object as a datasource for a local report. In Web application only Datasets are supported as datasource. I have been able to open an rdlc file and modify its...
0
by: lorentz | last post by:
Goo day. I'm working on a C# application and on this particular form, I have a datagridview control that is bounded to a datasource on load. I've implement a drag-drop event to the datagridview,...
0
by: shahiz | last post by:
This the error i get when i try to run my program Error: Unable to realize com.sun.media.amovie.AMController@18b81e3 Basically i have a mediapanel class that initialize and play the media as...
1
by: lchomany | last post by:
Can anyone tell me what the compiled error would be here? Saying "User-defined type not found" and highlighted objWord As Word.Document in yellow ______________________________ Private Sub...
0
by: davidiwharper | last post by:
Hello all I am trying to modify a CDO script that moves email messages out of a user's inbox and into a drop folder. I want to update it to use a Public Folder instead. The portion of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.