473,233 Members | 2,521 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,233 software developers and data experts.

Error getting Namespace

Hi,

I am trying to automate the Outlook so that I can get all
new messages received and look at them.

I have added refference "Microsoft Outlook 10.0 Object
Library" and written code:

private Outlook.Application oApp;
private Outlook._NameSpace oNameSpace;

public OutlookMail()
{

oApp = new Outlook.Application();
oNameSpace = oApp.GetNamespace("MAPI");
}

And that the line: oNameSpace = oApp.GetNamespace("MAPI");
it says that Outlook.Application does not contain a
definition for "GetNamespace". It does not contain the
definition for the CreateItem that I used to create new
Outlook._MailItem item.

What might be the problem?

Thatks,

Peter
Nov 15 '05 #1
1 3232

Hi Peter,

I can use the "Microsoft Outlook 10.0 Object Library" component well.
I think you should check the "References" folder in the Solution Explorer
if "Outlook" is added.
Then, you can check in the Object Browser window, if interop.outlook
assembly's Outlook|Application|_Application interface has the member
GetNamespace and CreateItem.

Btw: To get all the messages recieved like this:
oApp = new Outlook.Application();
oNameSpace = oApp.GetNamespace("MAPI");
Outlook.MAPIFolder
folder=oNameSpace.GetDefaultFolder(Outlook.OlDefau ltFolders.olFolderInbox);
Outlook.MailItem item=(Outlook.MailItem)folder.Items .Item(the item number
you want to display);
item.Display(null);

It works well on my machine.

Hope this helps,

Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "Peter Krikelis" <pk*******@hotmail.com>
| Sender: "Peter Krikelis" <pk*******@hotmail.com>
| Subject: Error getting Namespace
| Date: Fri, 10 Oct 2003 08:12:09 -0700
| Lines: 29
| Message-ID: <0d****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOPQOALVsm6Mx9xSpOP8KkiYt0SNA==
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:190577
| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Hi,
|
| I am trying to automate the Outlook so that I can get all
| new messages received and look at them.
|
| I have added refference "Microsoft Outlook 10.0 Object
| Library" and written code:
|
| private Outlook.Application oApp;
| private Outlook._NameSpace oNameSpace;
|
| public OutlookMail()
| {
|
| oApp = new Outlook.Application();
| oNameSpace = oApp.GetNamespace("MAPI");
| }
|
| And that the line: oNameSpace = oApp.GetNamespace("MAPI");
| it says that Outlook.Application does not contain a
| definition for "GetNamespace". It does not contain the
| definition for the CreateItem that I used to create new
| Outlook._MailItem item.
|
| What might be the problem?
|
| Thatks,
|
| Peter
|

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Enos Meroka | last post by:
Hallo, I am a student doing my project in the university.. I have been trying to compile the program using HP -UX aCC compiler, however I keep on getting the following errors. ...
4
by: Richard | last post by:
Hi All, I am using Visual C++ .Net to create a windows forms application and I am getting the following errors when I do a MessageBox::Show in my Form1.cpp file: Form1.cpp(19): error C2653:...
0
by: kevin_g_frey | last post by:
Hello We have an internal tool that generates a series of .NET class wrappers for accessing our database entities. One of our database entities is called "System" so our correspond __gc class is...
8
by: Charles | last post by:
I do not understand why I am getting a "Specified cast is not valid" error, since it has worked before. Something has changed and I am not really sure what it could be. I am looking for something...
6
by: jasn | last post by:
Hello I am getting the following error message when I try and send an XML sting to a web service, I read somewhere that most web services prefer ascii and some throw errors when using unicode so...
9
by: Prasad | last post by:
HI, I am a beginner in VC++.. I am trying to write a Win32 console application in visual studio.. I am using following header files.. #include <STRING> using namespace std; #include...
0
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
11
by: jakester | last post by:
I am using Visual C++ 2007 to build the code below. I keep getting linkage error. Could someone please tell me what I am doing wrong? The code works until I start using namespace for my objects. ...
3
by: rorni | last post by:
Hi, I'm porting code from Windows to HP-UX 11, compiling with g++. I'm getting a compilation error on the system's debug.h include file, which is included very indirectly through a series of...
0
by: =?Utf-8?B?a3Jpc2huYQ==?= | last post by:
Hi i am getting the following error while using XMLSerializer XmlSerializer ser = new XmlSerializer(typeof(Person)); ERROR: Unable to generate a temporary class (result=1). error CS0266: Cannot...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.