Erreur "l'application est en mode arrêt"
Bonjour,
J'essaye d'exécuter le code suivant qui permet de lire un message d'Outlook :
Code:
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 41 42 43 44 45 46
| using System;
using Microsoft.Office.Interop.Outlook;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
namespace lecture_d_un_fichier_msg_outlook
{
class Program
{
public static void Main()
{
//create new Outlook message from file
OutlookStorage.Message outlookMsg = new OutlookStorage.Message(@"C:\test.msg");
DisplayMessage(outlookMsg);
}
public static void DisplayMessage(OutlookStorage.Message outlookMsg)
{
Console.WriteLine("Subject: {0}", outlookMsg.Subject);
Console.WriteLine("Body: {0}", outlookMsg.BodyText);
Console.WriteLine("{0} Recipients", outlookMsg.Recipients.LongCount);
foreach (OutlookStorage.Recipient recip in outlookMsg.Recipients)
{
Console.WriteLine(" {0}:{1}", recip.Type, recip.Email);
}
Console.WriteLine("{0} Attachments", outlookMsg.Attachments.Count);
foreach (OutlookStorage.Attachment attach in outlookMsg.Attachments)
{
Console.WriteLine(" {0}, {1}b", attach.Filename, attach.Data.Length);
}
Console.WriteLine("{0} Messages", outlookMsg.Messages.Count);
foreach (OutlookStorage.Message subMessage in outlookMsg.Messages)
{
DisplayMessage(subMessage);
}
}
}
} |
Mais quand j'essaye de l'exécuter, j'ai le message d'erreur suivant :
Citation:
System.IO.FileNotFoundException*: 'Could not load file or assembly 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. Le fichier spécifié est introuvable.'
Savez-vous d'où cela peut venir ?