Tuesday, January 25, 2011

How to read all outlook calendar items using c#.net using outlook APIs

Here is the sample code to read all the outlook calendar item using c#.net.
Namespace
using Outlook = Microsoft.Office.Interop.
Outlook;
using Office = Microsoft.Office.Core;
Code:
        Microsoft.Office.Interop.
Outlook.Application app = null;
        NameSpace ns = null;
        private static Outlook.MAPIFolder calendar = null;
        private Outlook.Items appointments = null;

        app = this.Application;
        ns = app.GetNamespace("mapi");
        ns.Logon("", "", true, true);
        calendar = ns.GetDefaultFolder(
OlDefaultFolders. olFolderCalendar);
        appointments = calendar.Items;

No comments:

Post a Comment