-
H.
33
posts
Member since:
Feb 2011
Posted 09 Aug 2011
Link to this post
Hi,
I have a RadScheduler and I trying to save the new appointment or the changes to a Calendar List. I use the code below to get all the item in the calendar but I have expend 2 days try to find out what is the event that is triggering when the user press the button save.
With the code I was able to fill my calendar. I only need to know what event to use where I can put all the logic to write to the Calendar List. Thanks!!
Note. I am working with ASP.NET
private SPCalendarItemCollection GetCalendarItems()
{
// Create a new collection for the calendar items
// This is an item with a start and end date.
SPCalendarItemCollection items = new SPCalendarItemCollection();
SPWeb oWeb = SPControl.GetContextWeb(Context);
SPList oCalendarList = oWeb.Lists["Calendar"];
SPView oView = oCalendarList.Views["Calendar"];
SPQuery query = new SPQuery();
query.Query = "<OrderBy><FieldRef Name='ID' /></OrderBy>";
query.Query = "<Where><Eq><FieldRef Name='fRecurrence' /><Value Type='Recurrence'>0</Value></Eq></Where><OrderBy><FieldRef Name='ID' /></OrderBy>";
//For Team members (not for recurrent events)
foreach (SPListItem listItem in oCalendarList.GetItems(query))
{
SPCalendarItem calItem = new SPCalendarItem();
calItem.ItemID = listItem["ID"].ToString();
calItem.Title = listItem["Title"].ToString();
calItem.CalendarType = Convert.ToInt32(SPCalendarType.Gregorian);
calItem.StartDate = (DateTime)listItem["Start Time"];
calItem.ItemID = listItem.ID.ToString();
if (listItem["End Time"] != null)
{
calItem.hasEndDate = true;
calItem.EndDate = (DateTime)listItem["End Time"];
}
else
calItem.hasEndDate = false;
if (listItem["Description"] != null)
calItem.Description = listItem["Description"].ToString();
if (listItem["Location"] != null)
calItem.Location = listItem["Location"].ToString();
calItem.IsRecurrence = Convert.ToBoolean(listItem["Recurrence"]);
items.Add(calItem);
}
//Only for Reccurent events (like weekley meetings)
SPQuery queryRecurrence = new SPQuery();
queryRecurrence.ExpandRecurrence = true;
queryRecurrence.Query = "<Where>" +
"<And>" +
"<Eq>" +
"<FieldRef Name='fRecurrence' />" +
"<Value Type='Recurrence'>1</Value>" +
"</Eq>" +
"<DateRangesOverlap>" +
"<FieldRef Name='EventDate' />" +
"<FieldRef Name='EndDate' />" +
"<FieldRef Name='RecurrenceID' />" +
"<Value Type='DateTime'>" +
"<Month />" +
"</Value>" +
"</DateRangesOverlap>" +
"</And>" +
"</Where>" +
"<ViewFields>" +
"<FieldRef Name='Title' />" +
"<FieldRef Name='EventDate' />" +
"FieldRef Name='EndDate' />" +
"<FieldRef Name='fRecurrence' />" +
"<FieldRef Name='Absentee' />" +
"</ViewFields>";
// Look forward from the beginning of the current month
queryRecurrence.CalendarDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
// Returns all items (including recurrence instances) that
// would appear in the calendar view for the current month
SPListItemCollection calendarItems = oCalendarList.GetItems(queryRecurrence);
foreach (SPListItem listItem in oCalendarList.GetItems(queryRecurrence))
{
SPCalendarItem calItem = new SPCalendarItem();
calItem.ItemID = listItem["ID"].ToString();
calItem.Title = listItem["Title"].ToString();
calItem.CalendarType = Convert.ToInt32(SPCalendarType.Gregorian);
calItem.StartDate = (DateTime)listItem["Start Time"];
calItem.ItemID = listItem.ID.ToString();
if (listItem["End Time"] != null)
{
calItem.hasEndDate = true;
calItem.EndDate = (DateTime)listItem["End Time"];
}
else
calItem.hasEndDate = false;
if (listItem["Description"] != null)
calItem.Description = listItem["Description"].ToString();
if (listItem["Location"] != null)
calItem.Location = listItem["Location"].ToString();
items.Add(calItem);
}
// return the collection
return items;
}
-
-
H.
33
posts
Member since:
Feb 2011
-
-
-
-
H.
33
posts
Member since:
Feb 2011
Posted 11 Aug 2011
Link to this post
Thanks Peter for your reply but I am using the RadScheduler user control and not the SPRadSheduler web part. I need extra functionality that this web part does not have.Example to allow the user to subscribe to many calendar. Do you think it is possible to validate data before is save in the server side? or is it possible to use the SharePoint forms to add, edit and delete appointment in the RADScheduler? What event is triggering when the user press the button save?
Best Regards
HANK
-
-
Posted 17 Aug 2011
Link to this post
Hello H.,
I have attached here a basic RadScheduler WebPart sample - it is simplified but I believe that it will help you get started.
All the best,
Kalina
the Telerik team
-
-
H.
33
posts
Member since:
Feb 2011
-