Bonjour à tous

Je dois batir une appli en C# qui devra avoir un module permettant de remplir automatiquement le calendrier d'outlook, à partir d'un formulaire.
Ayant visualisé pas mal d'articles, j'ai donc créé un projet "Complement Outlook 2003" (version installée sur mon poste) et , à partir d'un exemple sur msdn, recopié le code suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
------------------------------------------------------
using System;
using System.Windows.Forms;
using Microsoft.VisualStudio.Tools.Applications.Runtime;
using Outlook = Microsoft.Office.Interop.Outlook;
using Office = Microsoft.Office.Core;
using Outlook2 = Microsoft.Office.Tools;

namespace OutlookAddIn1
{
    public partial class ThisAddIn
    {
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
                Outlook.AppointmentItem agendaMeeting = (Outlook.AppointmentItem)
                this.Application.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.
                olAppointmentItem);

            if (agendaMeeting != null)
            {
                agendaMeeting.MeetingStatus =
                    Microsoft.Office.Interop.Outlook.OlMeetingStatus.olMeeting;
                agendaMeeting.Location = "Conference Room";
                agendaMeeting.Subject = "Discussing the Agenda";
                agendaMeeting.Body = "Let's discuss the agenda.";
                agendaMeeting.Start = new DateTime(2009, 5, 5, 5, 0, 0);
                agendaMeeting.Duration = 60;
                Outlook.Recipient recipient =
                    agendaMeeting.Recipients.Add("Nate Sun");
                recipient.Type =
                    (int)Outlook.OlMeetingRecipientType.olRequired;
                ((Outlook._AppointmentItem)agendaMeeting).Send();
            }
        }

        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
        {
        }
       
      }---------------------------------------------
Je sais, à ce sniveau le formulaire n'est pas traité mais je voulais voir au moins comment la chose se presente .. Le pb c'est qu'à l'execution du code j'obtiens ce message :


Impossible d'exécuter l'opération. Objet introuvable.

************** Texte de l'exception **************
System.Runtime.InteropServices.COMException (0x98B4010F): Impossible d'exécuter l'opération. Objet introuvable.
à Microsoft.Office.Interop.Outlook._AppointmentItem.Send()
à OutlookAddIn1.ThisAddIn.ThisAddIn_Startup(Object sender, EventArgs e) dans E:\DT\Visual Studio 2008\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddIn.cs:ligne 30
à Microsoft.Office.Tools.AddIn.OnStartup()
à OutlookAddIn1.ThisAddIn.FinishInitialization() dans E:\DT\Visual Studio 2008\Projects\OutlookAddIn1\OutlookAddIn1\ThisAddIn.Designer.cs:ligne 65
à Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ExecutePhase(String methodName)
à Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ExecuteCustomizationStartupCode()
à Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ExecuteEntryPointsHelper()
à Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.Microsoft.VisualStudio.Tools.Applications.Runtime.IExecuteCustomization2.ExecuteEntryPoints()


************** Assemblys chargés **************
J'ai verifié la presence des references dans le projet .. Je vois pas quel est cet onjet introuvable. Avez vous une idée ??

Merci d'avance
Cordialement

Alain