C # zum Verschieben von E-Mails nach PST

Ich möchte mit C # auf meinen Outlook-Ordner "Gesendet" zugreifen und die Nachrichten dorthin in einen Ordner in meinem PST mit dem Namen "Archiv" verschieben. Dies ist der Code, mit dem ich gearbeitet habe, aber ich erhalte mehrere Kompilierungsfehler. Weiß hier jemand mit mehr Programmiererfahrung, wie man das macht?

static void MoveMe()
{
try
{
    _app = new Microsoft.Office.Interop.Outlook.Application();
    _ns = _app.GetNamespace("MAPI");
    _ns.Logon(null, null, false, false);
    Application.ActiveExplorer().Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderOutbox);
    Outlook.Items SentMailItems = SentMail.Items;
    Outlook.MailItem newEmail = null;
    foreach (object collectionItem in SentMailItems)
    {
        moveMail.Move(Archive);
    }
}
catch (System.Runtime.InteropServices.COMException ex)
{
    Console.WriteLine(ex.ToString());
}
finally
{
    _ns = null;
    _app = null;
    _inboxFolder = null;
}
}

Fehlerliste aus den Kommentaren:

Only assignment, call, increment, decrement, and new object expressions can be used as a statementThe type or namespace name 'Emails' could not be found (are you missing a using directive or an assembly reference?)The name 'A_Sent' does not exist in the current contextThe name 'moveMail' does not exist in the current contextThe name 'SentMail' does not exist in the current context

Antworten auf die Frage(1)

Ihre Antwort auf die Frage