Problem for using Outlook ApplicationClass

G

Guest

Hello :)

I would like to use Outlook 2003 in my application so for that, i've added
the referece to Outlook 11.0 Object Model to my project.

Then, I try this simple code :

using System;
using Microsoft.Office.Interop.Outlook;

namespace ConsoleApplication1
{
/// <summary>
/// Description résumée de Class1.
/// </summary>
class Class1
{
/// <summary>
/// Point d'entrée principal de l'application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
try
{
// Create an Outlook Application object.
ApplicationClass outLookApp = new ApplicationClass();
// Create a new TaskItem.
TaskItem newTask =
(TaskItem)outLookApp.CreateItem(OlItemType.olTaskItem);
// Configure the task at hand and save it.
newTask.Body = "Don't forget to send DOM the links...";
newTask.DueDate = DateTime.Now;
newTask.Importance = OlImportance.olImportanceHigh;
newTask.Subject = "Get DOM to stop bugging me.";
//newTask.Save();
}
catch(System.Exception ex)
{
Console.WriteLine("Exception catched. Message: " + ex.Message);
Console.WriteLine("Stack trace:\n" + ex.StackTrace);
Console.ReadLine();
}
}
}
}

But every time, an exception is catched on the first line:

ApplicationClass outLookApp = new ApplicationClass();

Here is the result of the exception:

Exception catched. Message: The specified module could not be found.


And the stack trace is :

Stack trace:
at ConsoleApplication1.Class1.Main(String[] args) in c:\documents and
setting
s\tom\mes documents\visual studio
projects\consoleapplication1\class1.cs:line 20


I've tried to repair Office without results.

I don't understand becasue i've aloready tried and code like this (on
Outlook 2000) and it worked fine. Now, on Outlook 2003, it doesn't work... :(

Any ideas ?

Thank You.
 
G

Guest

Hi Peter,

I've just tried it but I cant add a reference to
Microsoft.Office.Interop.Outlook. Every time, I can just add a reference to
Outlook 11 Object Model.....

Another idea ?

Thank you :)


-------------------
LEBRUN Thomas
http://morpheus.developpez.com
http://blog.developpez.com/index.php?blog=9


Peter Jausovec said:
Hi Thomas,

Check this sample:

http://blog.jausovec.net/index.php?op=ViewArticle&articleId=68&blogId=1

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
LEBRUN Thomas said:
Hello :)

I would like to use Outlook 2003 in my application so for that, i've added
the referece to Outlook 11.0 Object Model to my project.

Then, I try this simple code :

using System;
using Microsoft.Office.Interop.Outlook;

namespace ConsoleApplication1
{
/// <summary>
/// Description résumée de Class1.
/// </summary>
class Class1
{
/// <summary>
/// Point d'entrée principal de l'application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
try
{
// Create an Outlook Application object.
ApplicationClass outLookApp = new ApplicationClass();
// Create a new TaskItem.
TaskItem newTask =
(TaskItem)outLookApp.CreateItem(OlItemType.olTaskItem);
// Configure the task at hand and save it.
newTask.Body = "Don't forget to send DOM the links...";
newTask.DueDate = DateTime.Now;
newTask.Importance = OlImportance.olImportanceHigh;
newTask.Subject = "Get DOM to stop bugging me.";
//newTask.Save();
}
catch(System.Exception ex)
{
Console.WriteLine("Exception catched. Message: " + ex.Message);
Console.WriteLine("Stack trace:\n" + ex.StackTrace);
Console.ReadLine();
}
}
}
}

But every time, an exception is catched on the first line:

ApplicationClass outLookApp = new ApplicationClass();

Here is the result of the exception:

Exception catched. Message: The specified module could not be found.


And the stack trace is :

Stack trace:
at ConsoleApplication1.Class1.Main(String[] args) in c:\documents and
setting
s\tom\mes documents\visual studio
projects\consoleapplication1\class1.cs:line 20


I've tried to repair Office without results.

I don't understand becasue i've aloready tried and code like this (on
Outlook 2000) and it worked fine. Now, on Outlook 2003, it doesn't work...
:(

Any ideas ?

Thank You.
 
P

Peter Jausovec

You have to add a reference to Outlook 11 Object Model.dll ...
ApplicationClass outLookApp = new ApplicationClass();

Instead of this you should have: Application outlookApp = new Application
(); -- where Application is interface from Microsoft.Office.Interop.Outlook
(Outlook 11 Object Model.dll).

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
LEBRUN Thomas said:
Hi Peter,

I've just tried it but I cant add a reference to
Microsoft.Office.Interop.Outlook. Every time, I can just add a reference
to
Outlook 11 Object Model.....

Another idea ?

Thank you :)


-------------------
LEBRUN Thomas
http://morpheus.developpez.com
http://blog.developpez.com/index.php?blog=9


Peter Jausovec said:
Hi Thomas,

Check this sample:

http://blog.jausovec.net/index.php?op=ViewArticle&articleId=68&blogId=1

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
LEBRUN Thomas said:
Hello :)

I would like to use Outlook 2003 in my application so for that, i've
added
the referece to Outlook 11.0 Object Model to my project.

Then, I try this simple code :

using System;
using Microsoft.Office.Interop.Outlook;

namespace ConsoleApplication1
{
/// <summary>
/// Description résumée de Class1.
/// </summary>
class Class1
{
/// <summary>
/// Point d'entrée principal de l'application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
try
{
// Create an Outlook Application object.
ApplicationClass outLookApp = new ApplicationClass();
// Create a new TaskItem.
TaskItem newTask =
(TaskItem)outLookApp.CreateItem(OlItemType.olTaskItem);
// Configure the task at hand and save it.
newTask.Body = "Don't forget to send DOM the links...";
newTask.DueDate = DateTime.Now;
newTask.Importance = OlImportance.olImportanceHigh;
newTask.Subject = "Get DOM to stop bugging me.";
//newTask.Save();
}
catch(System.Exception ex)
{
Console.WriteLine("Exception catched. Message: " + ex.Message);
Console.WriteLine("Stack trace:\n" + ex.StackTrace);
Console.ReadLine();
}
}
}
}

But every time, an exception is catched on the first line:

ApplicationClass outLookApp = new ApplicationClass();

Here is the result of the exception:

Exception catched. Message: The specified module could not be found.


And the stack trace is :

Stack trace:
at ConsoleApplication1.Class1.Main(String[] args) in c:\documents and
setting
s\tom\mes documents\visual studio
projects\consoleapplication1\class1.cs:line 20


I've tried to repair Office without results.

I don't understand becasue i've aloready tried and code like this (on
Outlook 2000) and it worked fine. Now, on Outlook 2003, it doesn't
work...
:(

Any ideas ?

Thank You.
 
G

Guest

I've just tried it :

Application outLookApp = new Application();

but i'm still having the same error...

Thank You

-------------------
LEBRUN Thomas
http://morpheus.developpez.com
http://blog.developpez.com/index.php?blog=9

Peter Jausovec said:
You have to add a reference to Outlook 11 Object Model.dll ...
ApplicationClass outLookApp = new ApplicationClass();

Instead of this you should have: Application outlookApp = new Application
(); -- where Application is interface from Microsoft.Office.Interop.Outlook
(Outlook 11 Object Model.dll).

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
LEBRUN Thomas said:
Hi Peter,

I've just tried it but I cant add a reference to
Microsoft.Office.Interop.Outlook. Every time, I can just add a reference
to
Outlook 11 Object Model.....

Another idea ?

Thank you :)


-------------------
LEBRUN Thomas
http://morpheus.developpez.com
http://blog.developpez.com/index.php?blog=9


Peter Jausovec said:
Hi Thomas,

Check this sample:

http://blog.jausovec.net/index.php?op=ViewArticle&articleId=68&blogId=1

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
"LEBRUN Thomas" <lebrun_thomas_at_hotmail.com> je napisal v sporoeilo
...
Hello :)

I would like to use Outlook 2003 in my application so for that, i've
added
the referece to Outlook 11.0 Object Model to my project.

Then, I try this simple code :

using System;
using Microsoft.Office.Interop.Outlook;

namespace ConsoleApplication1
{
/// <summary>
/// Description résumée de Class1.
/// </summary>
class Class1
{
/// <summary>
/// Point d'entrée principal de l'application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
try
{
// Create an Outlook Application object.
ApplicationClass outLookApp = new ApplicationClass();
// Create a new TaskItem.
TaskItem newTask =
(TaskItem)outLookApp.CreateItem(OlItemType.olTaskItem);
// Configure the task at hand and save it.
newTask.Body = "Don't forget to send DOM the links...";
newTask.DueDate = DateTime.Now;
newTask.Importance = OlImportance.olImportanceHigh;
newTask.Subject = "Get DOM to stop bugging me.";
//newTask.Save();
}
catch(System.Exception ex)
{
Console.WriteLine("Exception catched. Message: " + ex.Message);
Console.WriteLine("Stack trace:\n" + ex.StackTrace);
Console.ReadLine();
}
}
}
}

But every time, an exception is catched on the first line:

ApplicationClass outLookApp = new ApplicationClass();

Here is the result of the exception:

Exception catched. Message: The specified module could not be found.


And the stack trace is :

Stack trace:
at ConsoleApplication1.Class1.Main(String[] args) in c:\documents and
setting
s\tom\mes documents\visual studio
projects\consoleapplication1\class1.cs:line 20


I've tried to repair Office without results.

I don't understand becasue i've aloready tried and code like this (on
Outlook 2000) and it worked fine. Now, on Outlook 2003, it doesn't
work...
:(

Any ideas ?

Thank You.
 
P

Peter Jausovec

Thomas,
email me

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
LEBRUN Thomas said:
I've just tried it :

Application outLookApp = new Application();

but i'm still having the same error...

Thank You

-------------------
LEBRUN Thomas
http://morpheus.developpez.com
http://blog.developpez.com/index.php?blog=9

Peter Jausovec said:
You have to add a reference to Outlook 11 Object Model.dll ...
ApplicationClass outLookApp = new ApplicationClass();

Instead of this you should have: Application outlookApp = new Application
(); -- where Application is interface from
Microsoft.Office.Interop.Outlook
(Outlook 11 Object Model.dll).

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
LEBRUN Thomas said:
Hi Peter,

I've just tried it but I cant add a reference to
Microsoft.Office.Interop.Outlook. Every time, I can just add a
reference
to
Outlook 11 Object Model.....

Another idea ?

Thank you :)


-------------------
LEBRUN Thomas
http://morpheus.developpez.com
http://blog.developpez.com/index.php?blog=9


:

Hi Thomas,

Check this sample:

http://blog.jausovec.net/index.php?op=ViewArticle&articleId=68&blogId=1

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
"LEBRUN Thomas" <lebrun_thomas_at_hotmail.com> je napisal v sporoeilo
...
Hello :)

I would like to use Outlook 2003 in my application so for that, i've
added
the referece to Outlook 11.0 Object Model to my project.

Then, I try this simple code :

using System;
using Microsoft.Office.Interop.Outlook;

namespace ConsoleApplication1
{
/// <summary>
/// Description résumée de Class1.
/// </summary>
class Class1
{
/// <summary>
/// Point d'entrée principal de l'application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
try
{
// Create an Outlook Application object.
ApplicationClass outLookApp = new ApplicationClass();
// Create a new TaskItem.
TaskItem newTask =
(TaskItem)outLookApp.CreateItem(OlItemType.olTaskItem);
// Configure the task at hand and save it.
newTask.Body = "Don't forget to send DOM the links...";
newTask.DueDate = DateTime.Now;
newTask.Importance = OlImportance.olImportanceHigh;
newTask.Subject = "Get DOM to stop bugging me.";
//newTask.Save();
}
catch(System.Exception ex)
{
Console.WriteLine("Exception catched. Message: " + ex.Message);
Console.WriteLine("Stack trace:\n" + ex.StackTrace);
Console.ReadLine();
}
}
}
}

But every time, an exception is catched on the first line:

ApplicationClass outLookApp = new ApplicationClass();

Here is the result of the exception:

Exception catched. Message: The specified module could not be found.


And the stack trace is :

Stack trace:
at ConsoleApplication1.Class1.Main(String[] args) in c:\documents
and
setting
s\tom\mes documents\visual studio
projects\consoleapplication1\class1.cs:line 20


I've tried to repair Office without results.

I don't understand becasue i've aloready tried and code like this
(on
Outlook 2000) and it worked fine. Now, on Outlook 2003, it doesn't
work...
:(

Any ideas ?

Thank You.
 
G

Guest

Email sent.

Thank you

-------------------
LEBRUN Thomas
http://morpheus.developpez.com
http://blog.developpez.com/index.php?blog=9


Peter Jausovec said:
Thomas,
email me

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
LEBRUN Thomas said:
I've just tried it :

Application outLookApp = new Application();

but i'm still having the same error...

Thank You

-------------------
LEBRUN Thomas
http://morpheus.developpez.com
http://blog.developpez.com/index.php?blog=9

Peter Jausovec said:
You have to add a reference to Outlook 11 Object Model.dll ...

ApplicationClass outLookApp = new ApplicationClass();

Instead of this you should have: Application outlookApp = new Application
(); -- where Application is interface from
Microsoft.Office.Interop.Outlook
(Outlook 11 Object Model.dll).

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
"LEBRUN Thomas" <lebrun_thomas_at_hotmail.com> je napisal v sporoeilo
...
Hi Peter,

I've just tried it but I cant add a reference to
Microsoft.Office.Interop.Outlook. Every time, I can just add a
reference
to
Outlook 11 Object Model.....

Another idea ?

Thank you :)


-------------------
LEBRUN Thomas
http://morpheus.developpez.com
http://blog.developpez.com/index.php?blog=9


:

Hi Thomas,

Check this sample:

http://blog.jausovec.net/index.php?op=ViewArticle&articleId=68&blogId=1

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
"LEBRUN Thomas" <lebrun_thomas_at_hotmail.com> je napisal v sporoeilo
...
Hello :)

I would like to use Outlook 2003 in my application so for that, i've
added
the referece to Outlook 11.0 Object Model to my project.

Then, I try this simple code :

using System;
using Microsoft.Office.Interop.Outlook;

namespace ConsoleApplication1
{
/// <summary>
/// Description résumée de Class1.
/// </summary>
class Class1
{
/// <summary>
/// Point d'entrée principal de l'application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
try
{
// Create an Outlook Application object.
ApplicationClass outLookApp = new ApplicationClass();
// Create a new TaskItem.
TaskItem newTask =
(TaskItem)outLookApp.CreateItem(OlItemType.olTaskItem);
// Configure the task at hand and save it.
newTask.Body = "Don't forget to send DOM the links...";
newTask.DueDate = DateTime.Now;
newTask.Importance = OlImportance.olImportanceHigh;
newTask.Subject = "Get DOM to stop bugging me.";
//newTask.Save();
}
catch(System.Exception ex)
{
Console.WriteLine("Exception catched. Message: " + ex.Message);
Console.WriteLine("Stack trace:\n" + ex.StackTrace);
Console.ReadLine();
}
}
}
}

But every time, an exception is catched on the first line:

ApplicationClass outLookApp = new ApplicationClass();

Here is the result of the exception:

Exception catched. Message: The specified module could not be found.


And the stack trace is :

Stack trace:
at ConsoleApplication1.Class1.Main(String[] args) in c:\documents
and
setting
s\tom\mes documents\visual studio
projects\consoleapplication1\class1.cs:line 20


I've tried to repair Office without results.

I don't understand becasue i've aloready tried and code like this
(on
Outlook 2000) and it worked fine. Now, on Outlook 2003, it doesn't
work...
:(

Any ideas ?

Thank You.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top