Powered by Blogger.

Sunday, February 23, 2014

RDOItems GetActivitiesForTimeRange() function in outlook addin development C#.Net



In this post we will discuss about GetActivitiesForTimeRange() function in outlook addin development C#.Net. Also you can check out my previous posts on:

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

- How to add menus in outlook menu bar using C#.net object model?

- How to read recurrance Pattern of a outlook meeting using redemption using c#.net?

GetActivitiesForTimeRange is a method that returns calendar meeting items between the specified date range in C#.Net API. Here is a sample you can follow for reference.

RDOAppointmentItem mitem = null;
RDOSessionClass session = new RDOSessionClass();
               session.Logon("", "", false, false, null, false);
               RDOFolder2 folder = (RDOFolder2)session.
GetDefaultFolder( rdoDefaultFolders. olFolderCalendar);
               RDOItems items = folder. GetActivitiesForTimeRange( StartDate.Date, StartDate.Date.AddDays(1), true);
               foreach (object item in items)
               {
                   mitem = item as RDOAppointmentItem;
          //You can also check whether the item is a recurring item or not.
                   if (mitem.IsRecurring)
                   {
                       //You can do whatever you want.
                   }
               }