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

Xamarin.Forms Calendar and ListView using Office365 and Outlook API

1 Answer 145 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nathan
Top achievements
Rank 1
Nathan asked on 04 Aug 2016, 12:02 PM
Hello,

I'm looking for a control that can use the Office365/Outlook API to add, edit and delete the data.

I've stumbled across the Xamarin Telerik Calendar and ListView. I'm just wondering if I can bind the users data from the authenticated account into these controls. I've managed to auth the user and add the control to a tabbed page but I'm a little stuck on how to bind the data into the controls.

Good reads or samples would be great. 

Thanks

1 Answer, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 08 Aug 2016, 09:32 PM
Hello Nathan,

The UI for Xamarin Calendar has a property "AppointmentsSource", which can use a collection of objects that implement the IAppointment interface. The interface has three properties that you need to implement in your model:

pubic interface IAppointment
{
    public DateTime StartDate  { get; set; }
    public DateTime EndDate  { get; set; }
    public string Title  { get; set; }
}


It doesn't matter where your data comes from, it could be from an O365 API or manually created in the app, as long as you implement the interface you can use the Calendar to show the appointments.

See here for an example of implementing it.

From what I can tell about the O365 API Calendar Event object (aka Appointment), you get a Start, an End and a Subject value for each of the Events that are returned. This means you have the minimum needed to fulfill the IAppointment's requirements.

Here's a pseudo-code example of what that would look like (we cannot see your model, and editing it directly is out-of-scope for Telerik support). To accomodate the Calendar, just return the properties that are already there for the O365 object)

public class MyO365EventModel : IAppointment, INotifyPropertyChanged
{
    public DateTime Start {get; set;}
    public DateTime End {get;set;}
    public string Subject [get;set;}
 
    //properties needed to implement IAppointment
 
    public DateTime StartDate
    {
        get { return this.Start ; }
        set { this.Start = value; OnPropertyChanged}
    }
     //repeat similar approach for EndDate and Title (I would point Title at "Subject")
}

Please let us know if you have any further questions. Thank you for contacting Support and for choosing Telerik by Progress.

Regards,
Lance | Tech Support Engineer, Sr.
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Nathan
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Share this question
or