A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - General Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Outlook in VB.NET



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 28th 08, 05:46 PM posted to microsoft.public.dotnet.languages.vb,microsoft.public.outlook
fniles
external usenet poster
 
Posts: 9
Default Outlook in VB.NET

I am using VB.NET 2005. I created a project using the Microsoft Outlook 8.0
Object Library (Object Model) in my previous machine. Now that I have a new
machine, when I try to compile that program in the new machine, it gives me
erros like "Type 'Outlook.Application' is not defined", "Type
'Outlook.NameSpace' is not defined".
I have MS Outlook in my new machine.
In the new machine when I go to "Add Reference", select the COM tab, the
only MS Outlook listed is "Microsoft Outlook 11.0 Object Library", while in
the previous machine both "Microsoft Outlook 11.0 Object Library" and
"Microsoft Outlook 8.0 Object Model".
If I select "Microsoft Outlook 11.0 Object Library", in the program when I
type in "dim ol as new", only "OutlookMail" is listed, while in the previous
machine "Outlook" and "OutlookMail" are listed.
How can I compile this program in my new machine ?

Thank you.


  #2  
Old February 28th 08, 07:38 PM posted to microsoft.public.dotnet.languages.vb,microsoft.public.outlook
Brian Tillman
external usenet poster
 
Posts: 17,452
Default Outlook in VB.NET

fniles wrote:

I am using VB.NET 2005. I created a project using the Microsoft
Outlook 8.0 Object Library (Object Model) in my previous machine. Now
that I have a new machine, when I try to compile that program in the
new machine, it gives me erros like "Type 'Outlook.Application' is
not defined", "Type 'Outlook.NameSpace' is not defined".
I have MS Outlook in my new machine.
In the new machine when I go to "Add Reference", select the COM tab,
the only MS Outlook listed is "Microsoft Outlook 11.0 Object
Library", while in the previous machine both "Microsoft Outlook 11.0
Object Library" and "Microsoft Outlook 8.0 Object Model".
If I select "Microsoft Outlook 11.0 Object Library", in the program
when I type in "dim ol as new", only "OutlookMail" is listed, while
in the previous machine "Outlook" and "OutlookMail" are listed.
How can I compile this program in my new machine ?


Ask in microsoft.public.outlook.program_vba
--
Brian Tillman [MVP-Outlook]
  #3  
Old February 28th 08, 09:35 PM posted to microsoft.public.dotnet.languages.vb,microsoft.public.outlook
Family Tree Mike
external usenet poster
 
Posts: 2
Default Outlook in VB.NET



"Brian Tillman" wrote:

fniles wrote:

I am using VB.NET 2005. I created a project using the Microsoft
Outlook 8.0 Object Library (Object Model) in my previous machine. Now
that I have a new machine, when I try to compile that program in the
new machine, it gives me erros like "Type 'Outlook.Application' is
not defined", "Type 'Outlook.NameSpace' is not defined".
I have MS Outlook in my new machine.
In the new machine when I go to "Add Reference", select the COM tab,
the only MS Outlook listed is "Microsoft Outlook 11.0 Object
Library", while in the previous machine both "Microsoft Outlook 11.0
Object Library" and "Microsoft Outlook 8.0 Object Model".
If I select "Microsoft Outlook 11.0 Object Library", in the program
when I type in "dim ol as new", only "OutlookMail" is listed, while
in the previous machine "Outlook" and "OutlookMail" are listed.
How can I compile this program in my new machine ?


Ask in microsoft.public.outlook.program_vba
--
Brian Tillman [MVP-Outlook]


But it's not a VBA question, unless I'm missing something.

I believe that you need to have the earliest version of outlook on the
development platform that you wish to support. Outlook 8.0 is Outlook '97,
so do you really need to support that?


  #4  
Old February 29th 08, 03:12 PM posted to microsoft.public.dotnet.languages.vb,microsoft.public.outlook
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook in VB.NET

There are no .NET specific programming groups for Outlook, the group Brian
recommended is as good as any.

You need the earliest version but Outlook 2000 was the first to support COM
Addins. Managed code for Outlook versions earlier than 2003 is funky and not
really the best way to go. There is a PIA for Outlook 2002 that can be
modified to work with Outlook 2000, but not everything works correctly. If
you now have Outlook 2003 on your computer program for that unless there's
some reason you still need to support an 11 year old version of Outlook.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Family Tree Mike" wrote in
message ...


"Brian Tillman" wrote:

fniles wrote:

I am using VB.NET 2005. I created a project using the Microsoft
Outlook 8.0 Object Library (Object Model) in my previous machine. Now
that I have a new machine, when I try to compile that program in the
new machine, it gives me erros like "Type 'Outlook.Application' is
not defined", "Type 'Outlook.NameSpace' is not defined".
I have MS Outlook in my new machine.
In the new machine when I go to "Add Reference", select the COM tab,
the only MS Outlook listed is "Microsoft Outlook 11.0 Object
Library", while in the previous machine both "Microsoft Outlook 11.0
Object Library" and "Microsoft Outlook 8.0 Object Model".
If I select "Microsoft Outlook 11.0 Object Library", in the program
when I type in "dim ol as new", only "OutlookMail" is listed, while
in the previous machine "Outlook" and "OutlookMail" are listed.
How can I compile this program in my new machine ?


Ask in microsoft.public.outlook.program_vba
--
Brian Tillman [MVP-Outlook]


But it's not a VBA question, unless I'm missing something.

I believe that you need to have the earliest version of outlook on the
development platform that you wish to support. Outlook 8.0 is Outlook
'97,
so do you really need to support that?



  #5  
Old February 29th 08, 05:28 PM posted to microsoft.public.dotnet.languages.vb,microsoft.public.outlook
fniles
external usenet poster
 
Posts: 9
Default Outlook in VB.NET

Both machines actually has Outlook 2003, but in the new machine I can not
see "Outlook" when I do "dim x as new ....", even though I already select
"Microsoft Outlook 11.0 Object Library"
This is the codes that I use to send email in VB.NET 2005:

Public Class OutlookMail
Public Function startOutlook(ByVal toVal As String, ByVal subjectVal As
String, ByVal bodyVal As String)
'Return a reference to the MAPI layer
Dim ol As New Outlook.Application() -- in the new machine this
gives the error "Type 'Outlook.application' is not defined
Dim ns As Outlook.NameSpace -- in the new machine this gives the
error "Type 'Outlook.NameSpace' is not defined
Dim fdMail As Outlook.MAPIFolder -- in the new machine this gives
the error "Type 'Outlook.MAPIFolder' is not defined

ns = ol.GetNamespace("MAPI")

'Logs on the user
'Profile: This is a string value that indicates what MAPI profile to
use for logging on. Leave blank if using the currently logged on user, or
set to an empty string ("") if you wish to use the default Outlook Profile.
'Password: The password for the indicated profile. Leave blank if
using the currently logged on user, or set to an empty string ("") if you
wish to use the default Outlook Profile password.
'ShowDialog: Set to True to display the Outlook Profile dialog box.
'NewSession: Set to True to start a new session. Set to False to use
the current session.
ns.Logon(, , True, True)

'create a new MailItem object
Dim newMail As Outlook.MailItem -- in the new machine this gives
the error "Type 'Outlook.MailItem' is not defined

'gets defaultfolder for my Outlook Outbox
fdMail =
ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFol derOutbox) -- in the new
machine this gives the error "Name 'Outlook' is not declared

'assign values to the newMail MailItem
newMail = fdMail.Items.Add(Outlook.OlItems.olMailItem) -- in the
new machine this gives the error "Name 'Outlook' is not declared
newMail.Subject = subjectVal
newMail.Body = bodyVal
newMail.To = toVal
newMail.SaveSentMessageFolder = fdMail
'adds it to the draft box
'newMail.Save()

'adds it to the outbox
newMail.Send()
End Function


"Ken Slovak - [MVP - Outlook]" wrote in message
...
There are no .NET specific programming groups for Outlook, the group Brian
recommended is as good as any.

You need the earliest version but Outlook 2000 was the first to support
COM Addins. Managed code for Outlook versions earlier than 2003 is funky
and not really the best way to go. There is a PIA for Outlook 2002 that
can be modified to work with Outlook 2000, but not everything works
correctly. If you now have Outlook 2003 on your computer program for that
unless there's some reason you still need to support an 11 year old
version of Outlook.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Family Tree Mike" wrote in
message ...


"Brian Tillman" wrote:

fniles wrote:

I am using VB.NET 2005. I created a project using the Microsoft
Outlook 8.0 Object Library (Object Model) in my previous machine. Now
that I have a new machine, when I try to compile that program in the
new machine, it gives me erros like "Type 'Outlook.Application' is
not defined", "Type 'Outlook.NameSpace' is not defined".
I have MS Outlook in my new machine.
In the new machine when I go to "Add Reference", select the COM tab,
the only MS Outlook listed is "Microsoft Outlook 11.0 Object
Library", while in the previous machine both "Microsoft Outlook 11.0
Object Library" and "Microsoft Outlook 8.0 Object Model".
If I select "Microsoft Outlook 11.0 Object Library", in the program
when I type in "dim ol as new", only "OutlookMail" is listed, while
in the previous machine "Outlook" and "OutlookMail" are listed.
How can I compile this program in my new machine ?

Ask in microsoft.public.outlook.program_vba
--
Brian Tillman [MVP-Outlook]


But it's not a VBA question, unless I'm missing something.

I believe that you need to have the earliest version of outlook on the
development platform that you wish to support. Outlook 8.0 is Outlook
'97,
so do you really need to support that?





  #6  
Old February 29th 08, 06:06 PM posted to microsoft.public.dotnet.languages.vb,microsoft.public.outlook
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook in VB.NET

Then there's something wrong about your Outlook project reference, or the
Outlook PIA's aren't installed correctly, or there's something wrong with
your installation of Visual Studio.

Try removing the Outlook reference and then re-adding it, making sure you
are taking the reference from the COM tab and that the PIA is installed in
the GAC.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"fniles" wrote in message
...
Both machines actually has Outlook 2003, but in the new machine I can not
see "Outlook" when I do "dim x as new ....", even though I already select
"Microsoft Outlook 11.0 Object Library"
This is the codes that I use to send email in VB.NET 2005:

Public Class OutlookMail
Public Function startOutlook(ByVal toVal As String, ByVal subjectVal As
String, ByVal bodyVal As String)
'Return a reference to the MAPI layer
Dim ol As New Outlook.Application() -- in the new machine this
gives the error "Type 'Outlook.application' is not defined
Dim ns As Outlook.NameSpace -- in the new machine this gives the
error "Type 'Outlook.NameSpace' is not defined
Dim fdMail As Outlook.MAPIFolder -- in the new machine this gives
the error "Type 'Outlook.MAPIFolder' is not defined

ns = ol.GetNamespace("MAPI")

'Logs on the user
'Profile: This is a string value that indicates what MAPI profile
to use for logging on. Leave blank if using the currently logged on user,
or set to an empty string ("") if you wish to use the default Outlook
Profile.
'Password: The password for the indicated profile. Leave blank if
using the currently logged on user, or set to an empty string ("") if you
wish to use the default Outlook Profile password.
'ShowDialog: Set to True to display the Outlook Profile dialog box.
'NewSession: Set to True to start a new session. Set to False to
use the current session.
ns.Logon(, , True, True)

'create a new MailItem object
Dim newMail As Outlook.MailItem -- in the new machine this gives
the error "Type 'Outlook.MailItem' is not defined

'gets defaultfolder for my Outlook Outbox
fdMail =
ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFol derOutbox) -- in the
new machine this gives the error "Name 'Outlook' is not declared

'assign values to the newMail MailItem
newMail = fdMail.Items.Add(Outlook.OlItems.olMailItem) -- in the
new machine this gives the error "Name 'Outlook' is not declared
newMail.Subject = subjectVal
newMail.Body = bodyVal
newMail.To = toVal
newMail.SaveSentMessageFolder = fdMail
'adds it to the draft box
'newMail.Save()

'adds it to the outbox
newMail.Send()
End Function


  #7  
Old February 29th 08, 08:28 PM posted to microsoft.public.dotnet.languages.vb,microsoft.public.outlook
Brian Tillman
external usenet poster
 
Posts: 17,452
Default Outlook in VB.NET

Family Tree Mike wrote:

But it's not a VBA question, unless I'm missing something.


What you're missing is that this group isn't geared for programming
questions. Since there is no .NET programming group, the vba group will, at
least, have other programmers visiting it. You MAY find a programmer here,
like Ken Slovak, but you're more likely to have your message viewed by
someone who can help if you're in a programming group. It's like being at a
convention and wanting to ask a medical question of a cardiologist. There
certainly might find that one of the attendees is a cardiologist, but your
chances are better if the convention is a physician's convention. (Although
you might run into a cardiologist in this newsgroup, too.)
--
Brian Tillman [MVP-Outlook]

  #8  
Old March 1st 08, 01:19 AM posted to microsoft.public.dotnet.languages.vb,microsoft.public.outlook
Family Tree Mike
external usenet poster
 
Posts: 2
Default Outlook in VB.NET



"Brian Tillman" wrote:

Family Tree Mike wrote:

But it's not a VBA question, unless I'm missing something.


What you're missing is that this group isn't geared for programming
questions. Since there is no .NET programming group, the vba group will, at
least, have other programmers visiting it. You MAY find a programmer here,
like Ken Slovak, but you're more likely to have your message viewed by
someone who can help if you're in a programming group. It's like being at a
convention and wanting to ask a medical question of a cardiologist. There
certainly might find that one of the attendees is a cardiologist, but your
chances are better if the convention is a physician's convention. (Although
you might run into a cardiologist in this newsgroup, too.)
--
Brian Tillman [MVP-Outlook]


Actually, this really threw me for a loop, until I just saw that this
message also went to Microsoft.Public.Outlook. I was viewing it from
Microsoft.Public.DotNet.Languages.VB, which does have programmers (and I
suppose cardiologists from time to time).




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:54 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.