Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to know Can I access the Outlook's cander event, schedule meeting information using ASp.NET?
Posted

1 solution

public  DataTable GetCalenderDetails()
        {
            DataTable table = new DataTable();
           table.Columns.Add("Subject", typeof(string));
           table.Columns.Add("Datetime", typeof(DateTime));
           table.Columns.Add("Location", typeof(string));
           table.Columns.Add("Organizer", typeof(string));
           Microsoft.Office.Interop.Outlook.Application oApp = null;
           Microsoft.Office.Interop.Outlook.NameSpace mapiNamespace = null;
           Microsoft.Office.Interop.Outlook.MAPIFolder calendarFolder = null;

           try
           {
               oApp = new Microsoft.Office.Interop.Outlook.Application();
               mapiNamespace = oApp.GetNamespace("MAPI");
               calendarFolder = mapiNamespace.GetDefaultFolder
               (Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar);

               DataRow dr;
               foreach (Microsoft.Office.Interop.Outlook.AppointmentItem item in
               calendarFolder.Items)
               {
                   dr = table.NewRow();
                   dr["Location"] = item.Location;
                   dr["Subject"] = item.Subject;
                   dr["Datetime"] = item.Start;
                   dr["Organizer"] = item.Organizer;
                   table.Rows.Add(dr);
               }
           }
           catch (Exception ex)
           {
               Console.WriteLine(ex.Message);
           }
           return table;
        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900