Powered by Blogger.

Sunday, February 23, 2014

Read all outlook calendar items using C#.net using outlook APIs

In this post we will discuss about how to read all outlook calendar items using C#.Net using outlook APIs. Also you can check out my previous posts on:

- Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements

- Close browser in button click in Asp.Net

- Implement delete functionality in Gridview in Asp.Net

Here is the sample code to read all the outlook calendar item using c#.net.

using Outlook = Microsoft.Office.Interop.Outlook;
using Office = Microsoft.Office.Core;

        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;