We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How can I get a "CustomAppointment"?

Hello. 

I attached the project file. If you run the project, you receive an error typecast. How can I get "CustomAppointment" using "SchedulerAppointment"?

Attachment: SfSchedule_CalendarEdit_3159e7ad.rar

3 Replies

VR Vigneshkumar Ramasamy Syncfusion Team August 16, 2016 07:00 AM UTC

Hi Berezkin, 
Based on your requirement we have modified the previous attached sample to get custom appointment from the schedule appointment and please find the sample in the below link. 
In the above sample we have used the below code snippet to get the custom appointment. 
  
var CustomAPP = GetCustomAppointment(schedule.Appointments[0]); 
 
>>>>>>>>>>>>>>>>>>>> 
 
  CustomAppointment GetCustomAppointment(ScheduleAppointment app) 
        { 
            CustomAppointment CustomApp = new CustomAppointment(); 
            CustomApp.Name = app.Subject; 
            CustomApp.Locaion = app.Location; 
            CustomApp.AppointmentStartTime = app.StartTime; 
            CustomApp.AppointmentEndTime = app.EndTime; 
            return CustomApp; 
        } 
 
If the above provided solution doesn’t satisfy you requirement could you, please provide more information about your requirement? So that we could analyze on your requirement further and provide you the possible solution. 
Regards 
Vigneshkumar R 



BG Berezkin Gena August 16, 2016 10:01 AM UTC

How can I get the Name (or Appointment_ID) property? He is not in the Schedule Appointment.
        CustomAppointment GetCustomAppointment(ScheduleAppointment app)
        {
            CustomAppointment CustomApp = new CustomAppointment();
            CustomApp.Name = app.Subject;
            CustomApp.Locaion = app.Location;
            CustomApp.AppointmentStartTime = app.StartTime;
            CustomApp.AppointmentEndTime = app.EndTime;
            CustomApp.Name = ???app.Name???;
            return CustomApp;
        }


VR Vigneshkumar Ramasamy Syncfusion Team August 17, 2016 10:35 AM UTC

Hi Berezkin, 
As of now your requirement of getting Appointment_ID can be achieved by using CustomAppointment collection (Source). We have prepared a sample for the same and please find the sample in the below link. 
In the above sample we have used below code snippet to get the Appointment_ID. 
     foreach(CustomAppointment CustomApponitment in Source) 
            {  
                if(app.ObjectID== CustomApponitment.GetHashCode()) 
                { 
                    CustomApp.Appointment_ID = CustomApponitment.Appointment_ID; 
                } 
            } 
 
Regards 
Vigneshkumar R 


Loader.
Up arrow icon