Személyes eszközök
Keresés

 

A InfoWiki wikiből

C# program az Outlook Calendar elemek kiolvasására

Előtte adjuk hozzáa az References részben az Microsoft Outlook 12.0 Object Library-t (msoutl.olb). Ez két References bejegyzést készít, az Microsoft.Office.Core-t, és a Microsoft.Office.Interop.Outlook-t.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Interop.Outlook;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Application objOutlook = new ApplicationClass();
            NameSpace objNS = objOutlook.GetNamespace("MAPI");
            objNS.Logon("", "", false, true);
            //
            MAPIFolder mf = objNS.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
            for (int i = 1; i <= mf.Items.Count; i++)
            {
                AppointmentItem ai = (AppointmentItem)mf.Items[i];
                Console.WriteLine("{0} - {1} / {2}",ai.Subject, ai.Start,ai.Body);
            }
            Console.ReadLine();
        }
    }
}
Nézetek
nincs sb_3.147.61.142 cikk