I have a MVC5 Razor website that needs to show calendar appointments loaded from excahnge server.
I can do this by doing this:
var service = new ExchangeService { Credentials = new NetworkCredential("userName", "pass") };
service.AutodiscoverUrl("me@workplace.com");
var calendar = CalendarFolder.Bind(service, WellKnownFolderName.Calendar, new PropertySet());
var cView = new CalendarView(DateTime.Today, DateTime.Today.AddMonths(1));
cView.PropertySet = new PropertySet(ItemSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End, AppointmentSchema.Organizer);
var result = calendar.FindAppointments(cView);
But insted of the hardcoded credentials, I need the credentials (and from that I can get the email) of the current users Windows User. I also need to get appointments from a calender that is shared with that user, and not the users own calendar (but that is perhaps a seperate question).
Nothing I have tried works. Would love some help!
Other code:
private static bool RedirectionUrlValidationCallback(string redirectionUrl)
{
var result = false;
var redirectionUri = new Uri(redirectionUrl);
if (redirectionUri.Scheme == "https")
{
result = true;
}
return result;
}