Bonjour à tous,

Je ne sais pas si j'ai bien fait de poster ici ou si j'aurais du le faire dans la partie .Net C# donc dsl d'avance.

J'ai un problème de référence concernant un projet application console en C# :

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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Interop.Outlook;
using Microsoft.Office.Core;

namespace ConsoleApplicationOutlook
{
    class Program
    {
        static void Main(string[] args)
        {

            Microsoft.Office.Interop.Outlook._Application olApp = new Microsoft.Office.Interop.Outlook.ApplicationClass();
            Microsoft.Office.Interop.Outlook._NameSpace olNS = olApp.GetNamespace("MAPI"); Microsoft.Office.Interop.Outlook._Folders oFolders;
            oFolders = olNS.Folders;
            Microsoft.Office.Interop.Outlook.MAPIFolder oPublicFolder = oFolders.Item("Public Folders");
            oFolders = oPublicFolder.Folders;
            Microsoft.Office.Interop.Outlook.MAPIFolder oAllPFolder = oFolders.Item("All Public Folders");
            oFolders = oAllPFolder.Folders;
            Microsoft.Office.Interop.Outlook.MAPIFolder oMyFolder = oFolders.Item("My Public Folder");
            Console.Write(oMyFolder.Name);
        }
    }
}
Le problème intervient à ce niveau :

Microsoft.Office.Interop.Outlook.MAPIFolder oMyFolder = oFolders.Item("My Public Folder");

avec cette erreur :

Erreur 2 'Microsoft.Office.Interop.Outlook._Folders' ne contient pas une définition pour 'Item' et aucune méthode d'extension 'Item' acceptant un premier argument de type 'Microsoft.Office.Interop.Outlook._Folders' n'a été trouvée (une directive using ou une référence d'assembly est-elle manquante*?)
Savez-vous comment régler ce problème?

Merci d'avance,
Foyus