Thursday, April 26, 2012

Get the List of calendar events in ektron cms

The ektron calendar provides an easy ways to site admin to add,edit and update the events for calendar year or more.Here i will show how to get the calendar events list to list view.Using Web calendar API ,i will send the calendar id ,start date and end date as input parameters to get the list items between data range.Here the method Getlist() which will give the list of calendar events
 Ektron.Cms.Controls.Calendar c = new Ektron.Cms.Controls.Calendar();
 WebEventManager wManager = new WebEventManager();
 //calendar id in Workarea
 long calId = 1654;
 String st = DateTime.Now.ToString();//cuurent date
 String et = "31-04-2012 17:30:00";
 DateTime startdate= DateTime.Parse(st);
 DateTime enddate = DateTime.Parse(et);
 List webeventcalendarList = wManager.GetList(calId,startdate,enddate);
 if (webeventcalendarList != null)
{
list_events.DataSource = webeventcalendarList;
list_events.DataBind();
}
 else
{
Response.Write("There is no list of events");
}

4 comments:

Razi said...

I tried your code but I get an error "WebEventManager" not found. Are you missing any assembly reference.... etc.

Any suggestion?

Anonymous said...

I tried your code but I get an error saying WebEventManager not found. Are you missing assembly reference.....
Any suggeston?

Razi said...

I tried your code but I get an error saying WebEventManager not found. Are you missing assembly reference.....
Any suggeston?

Unknown said...

hi Razi,
thanks for comment.

we need add below assemblies to resolve this error.

using Ektron.Cms;
using Ektron.Cms.Controls;
using Ektron.Cms.API.Content;

if u will get after add libraries we can create object like in below peace of code

Ektron.Cms.Content.Calendar.WebEventManager newwebeventmanager= New Ektron.Cms.Content.Calendar.WebEventManager()

Bel