This is a migrated thread and some comments may be shown as answers.

Exchange and RADScheduler

12 Answers 242 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jan
Top achievements
Rank 1
Jan asked on 10 Feb 2012, 02:39 PM
Hi!

What we need is to get outlook appointment from a number of different users and show them
on a webpage. Here the RADscheduler could be our answer!!! I have just made some test, and it is very simple to
show ONE specific outlook users appointment in the RADscheduler. (see the code below)

But how do you show more than one exchange users appointment in different groups on a webpage using the RADscheduler control?
For example show the user JATOV, HAGER and WEKJK.

Do you have a good code example of that? and is it even possible...

 

<telerik:RadScheduler ID="RadScheduler1" runat="server" Height="800px">

</telerik:RadScheduler>

 

RadScheduler1.Provider =

 

New ExchangeSchedulerProvider(https://XXXXXX/EWS/Exchange.asmx, "XXXX", "XXXXX", "DOMAIN")

 

 

 



12 Answers, 1 is accepted

Sort by
0
Jan
Top achievements
Rank 1
answered on 13 Feb 2012, 01:28 PM
Do you (telerik) understand my question  :) ?
0
Peter
Telerik team
answered on 14 Feb 2012, 11:55 AM
Hi Jan,

You can load all appointments in a List and use it to bind RadScheduler similarly to the way this is done in the
Import iCalendar Data code library sample. Would that work for your case?


Greetings,
Peter
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Jan
Top achievements
Rank 1
answered on 14 Feb 2012, 03:28 PM
I have a problem seeing how this example can be used.
What we would need is to show 4 or 5 users calender appointments in one Rad Scheduler webpage.
Perhabs using grouping in the rad scheduler.
In this simple example of yours (telerik)

http://www.telerik.com/help/aspnet-ajax/scheduler-exchange-provider.html

You are binding it to one specific user. But we want to show 4-5 users. It is a very big wish.

Do you have a example of that?
0
Peter
Telerik team
answered on 14 Feb 2012, 04:39 PM
Hi,

If you need resources, you should extend the following methods of the Exchange provider:

ExchangeSchedulerProvider.cs
/// <summary>
      /// Implement this method if you use custom resources.
      /// </summary>
      public override IEnumerable<ResourceType> GetResourceTypes(RadScheduler owner)
      {
          return new ResourceType[] { };
      }
 
      /// <summary>
      /// Implement this method if you use custom resources.
      /// </summary>
      public override IEnumerable<Resource> GetResourcesByType(RadScheduler owner, string resourceType)
      {
          return new Resource[] { };
      }


You can review how resources are implemented with the Database Provider and apply the approach to the Exchange provider.

Kind regards,
Peter
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
asimptota
Top achievements
Rank 1
answered on 23 May 2012, 07:40 AM
Hello,
RadScheduler is a great product! Especially for it's ability to utilize Exchange Web Services. Now, I need to be able to display appointments from all users and I want to be able to display users names as multiple resources for the appointment. I know that it can be implemented through editing ExchangeSchedulerProvider but, I don't know how. Could you please give me a hint by providing a piece of code?
0
asimptota
Top achievements
Rank 1
answered on 23 May 2012, 07:45 AM
I just wanted to ask if you have managed to accomplish displaying calendars from multiple outlook users?
0
Peter
Telerik team
answered on 24 May 2012, 08:25 PM
Hi Jasmin,

Thank you for your question.

Currently, we don't have a sample of displaying calendars from multiple outlook users, but I will log your query for research. If we succeed with a sample, we will let you know.


Regards,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
asimptota
Top achievements
Rank 1
answered on 25 May 2012, 09:28 AM
Thanx for the answer. I was affraid that you would say something like that....
Meanwhile, I've been doing some research and have managed to display appointments from different Exchange users (mailboxes) by using Exchange Web Services Managed API. Basically, I pulled appointments from different mailboxes, put them into List<Appointment> object and used that list as a DataSource for RadScheduler. It's fairly simple. I could post some code if anybody needs it.
0
Peter
Telerik team
answered on 25 May 2012, 10:03 AM
Hello Jasmin,

Yes, please post some code! That would be valuable to the community as this is a common request.

Regards,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
asimptota
Top achievements
Rank 1
answered on 25 May 2012, 10:57 AM
Ok.
So, first, you need to install Microsoft Exchange Web Services managed API 1.2 which you can find HERE. Next, you must reference Microsoft.Exchange.WebServices.dll (which is located in the folder where you installed Microsoft Exchange Web Services managed API 1.2).

Another important thing is that you must use Exchange account which has permission to view/insert/update/delete other users calendars. Without that, you won't be able to access other people's appointments.
Here's the code how to gather my appointments and another user's appointments where I have permission to view/insert/update/delete his appointments. The idea is to get all those appointments, put them into a List<Appointment> and use that list as a datasource for RadScheduler, just like in THIS EXAMPLE.

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Exchange.WebServices.Data;
using Telerik.Web.UI;
using Appointment = Microsoft.Exchange.WebServices.Data.Appointment;
 
namespace MyApplication.UI
{
    public partial class _Default : System.Web.UI.Page
    {
 
 
 
        protected void Page_Load(object sender, EventArgs e)
        {
            RadScheduler1.DataSource = Appointments;
             
              
        }
 
        protected void Page_Init(object sender, EventArgs e)
        {
             
        }
         
 
        private List<Appointment> Appointments
        {
             
            get
            {
                CalendarView calendar = new CalendarView(Convert.ToDateTime("01-01-2011"), Convert.ToDateTime("01-01-2013"));
                ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
                service.Credentials = new WebCredentials("myUserName", "MyPassword");
                service.AutodiscoverUrl("myUserName@company.com");
 
                List<Appointment> appointments = new List<Appointment>();
 
                try
                {
                    foreach (Appointment appointment in service.FindAppointments(WellKnownFolderName.Calendar, calendar))
                    {
                        appointments.Add(appointment);
                    }
                    FolderId _cal =
                            new FolderId(WellKnownFolderName.Calendar, new Mailbox("otherUser@company.com"));
 
                    foreach (Appointment appointment in service.FindAppointments(_cal, calendar))
                    {
                        appointments.Add(appointment);
                    }
 
                    return appointments;
                }
                catch(Exception)
                {
                    throw;
                }
 
 
            }
        }
 
 
        protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)
        {
 
            try
            {
                Appointment appointment = FindAppointmentById((string)e.ModifiedAppointment.ID);
                appointment.Subject = e.ModifiedAppointment.Subject;
                appointment.Update(ConflictResolutionMode.AlwaysOverwrite);
            }
            catch (Exception exception)
            {
 
                Response.Write(String.Format(@"<script>alert('{0}')</script>", exception));
            }
            finally
            {
                RadScheduler1.DataSource = Appointments;
 
            }
 
 
        }
 
 
 
        private Appointment FindAppointmentById(string id)
        {
            List<Appointment> appointments = Appointments;
            foreach (Appointment appointment in appointments)
            {
                if (appointment.Id.UniqueId == id)
                    return appointment;
            }
            return null;
        }
 
        protected void RadScheduler1_AppointmentDelete(object sender, AppointmentDeleteEventArgs e)
        {
            try
            {
                Appointment appointment = FindAppointmentById((string)e.Appointment.ID);
                appointment.Delete(DeleteMode.MoveToDeletedItems);
            }
            catch (Exception exception)
            {
 
                Response.Write(String.Format(@"<script>alert('{0}')</script>", exception));
 
            }
            finally
            {
                RadScheduler1.DataSource = Appointments;
            }
        }
 
 
    }
}
 

Here's the aspx code for RadScheduler:
<telerik:RadScheduler ID="RadScheduler1" runat="server" DataEndField="End"
    DataKeyField="Id.UniqueId" DataStartField="Start"
    DataSubjectField="Subject"
    onappointmentdelete="RadScheduler1_AppointmentDelete"
    onappointmentupdate="RadScheduler1_AppointmentUpdate">
</telerik:RadScheduler>

As you can see, it's fairly easy. I didn't write how to insert an appointment yet but you get the idea.
My idea is that after I put all those appointment into a list I find a way to group them by Exchange users. I still haven't managed to do that yet but if someone manages please, post it here.
0
Peter
Telerik team
answered on 28 May 2012, 10:37 AM
Hello Jasmin,

Thank you very much for sharing your workaround in the forum. I have updated your Telerik points.

Kind regards,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ismael
Top achievements
Rank 1
answered on 17 Feb 2015, 04:33 PM
Hi,
Do you have an example with insert method ?

I need to get the new ID of the appointment juste after the insert .

Thanks a lot
Tags
Scheduler
Asked by
Jan
Top achievements
Rank 1
Answers by
Jan
Top achievements
Rank 1
Peter
Telerik team
asimptota
Top achievements
Rank 1
Ismael
Top achievements
Rank 1
Share this question
or