Save the appointment in a SharePoint List

6 posts, 0 answers
  1. H.
    H. avatar
    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;
            }
  2. H.
    H. avatar
    33 posts
    Member since:
    Feb 2011

    Posted 10 Aug 2011 Link to this post

    Sorry, Can someone help me with this???
  3. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 11 Aug 2011 Link to this post

    Hi H.,

    Please, refer to this help topic -
    http://www.telerik.com/help/aspnet-ajax/moss-display-and-edit-appointments.html


    All the best,
    Peter
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  4. H.
    H. avatar
    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
  5. Kalina
    Admin
    Kalina avatar
    918 posts

    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

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  6. H.
    H. avatar
    33 posts
    Member since:
    Feb 2011

    Posted 17 Aug 2011 Link to this post

    Thanks Kalina!
Back to Top