Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2073
  • Last Modified:

Exchange 2010 Team Calendar EWS ASP.NET

I'm trying to build a team calendar in ASP.net using EWS connecting to Exchange 2010. Looking at a single day I'd like to see User1, User2, User3 all side by side. I've found information to create calendar items but not display the XML of the calendar itself. Can someone show me an example of that?
0
gregbrainerd
Asked:
gregbrainerd
  • 6
  • 5
1 Solution
 
LeeDerbyshireCommented:
Can you tell us a bit more about how you're trying to do it?  Is it a single appointment item folder in Public Folders, and are you reading users' calendars directly?  What kind of XML are you hoping to see?  The only time you would see any XML is in the server's response to your EWS request, but this isn't something you would normally display to a user - it's just the standardised way that the server returns the information to you.  You still need to interpret it and display it.
0
 
gregbrainerdAuthor Commented:
Sure, I'm trying to build a website that would display an OWA style calendar but with multiple users. So at a glance you'd see my calendar, Bob's and Sally's calendar in the same view. Here is an example that was built for Exchange 2003 WebDAV which is not supported by 2007/2010.

http://www.codeproject.com/KB/aspnet/teamcalendar.aspx
0
 
LeeDerbyshireCommented:
So, the calendars are in mailboxes, not public folders?  I assume that you have permission to read the calendars, or are they configured so that anyone can access them?  If you can access them directly from the OWA URL:
https://server/owa/user@domain.com/?cmd=contents&module=calendar
your easiest option would be to create a simple html page with iframes pointing at each calendar.  Like:

<iframe src="https://server/owa/user1@domain.com/?cmd=contents&module=calendar"></iframe>
<iframe src="https://server/owa/user2@domain.com/?cmd=contents&module=calendar"></iframe>

etc.  Of course, if you want something that isn't like the OWA layout, then you will indeed need to make something yourself.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
gregbrainerdAuthor Commented:
Yes I would have permissions to the mailboxes. This is an intersting solution and is what I want the layout to appear exactly like but if you double click on a calendar appointment I'd rather redirect it to a custom window to appear that will write both to the calendar and to a SQL DB.

I can create calendar events using the following code to create new appointments.
Dim myAppt As New Appointment(myService)
        myAppt.Subject = "TEST"
        myAppt.Start = DateTime.Now
        myAppt.End = DateTime.Now.AddHours(1.5)
        myAppt.StartTimeZone = TimeZoneInfo.Local
        myAppt.Body = "My Calendar Event!"

        '//Make appointment reoccur
        myAppt.Recurrence = New Recurrence.WeeklyPattern(DateTime.Now, 1, DayOfWeek.Friday)

        '//Save to calendar
        myAppt.Save()

Open in new window

0
 
LeeDerbyshireCommented:
Okay, so I guess first thing you want is a list of the calendar items.  I don't use high-level EWS APIs (preferring to send/decode XML requests manually), but I can't recommend that you do the same, since I know that doesn't suit everyone (although if you really want to try it, I have something similar here http://www.leederbyshire.com/Articles/EWS-FindItem-Other-Mailbox-Exchange-2007.asp ).  Problem is, that means I don't have any 'normal' EWS code of my own to paste for you.  What I can tell you is that you want to use the EWS CalendarView object.  A search reveals that someone has used one to open a shared calendar here.  The article might be of some use to you:
http://stackoverflow.com/questions/5139408/accessing-shared-calendars-with-exchange-web-services
0
 
gregbrainerdAuthor Commented:
I'll take a look at those examples and let you know what I figure out.
0
 
gregbrainerdAuthor Commented:
Okay, the leederbyshire is using XML and after futher study it appears that XML is not supported with VB.net and when trying that script as an HTM I get an permission denied even when modifying the following line

objXMLHTTP.Open "POST", strURL, false, strdomain & "\" & username, password


So, XML is out and I need to try a different approach to getting the calendar from OWA (Exchange 2010) into ASP.net
0
 
gregbrainerdAuthor Commented:
The example from stackoverflow gives me the info that I am looking for. But I'd like it to be in the OWA calendar format. Maybe I need to build my own calendar to place this in?


Imports Microsoft.Exchange.WebServices.Data
Imports Microsoft.Exchange.WebServices.Autodiscover


	Dim myService As New ExchangeService
        myService.Credentials = New WebCredentials("username@domain.local", "myPassw0rd")
        myService.Url = New Uri("https://fqdn.com/EWS/exchange.asmx")

        Dim _cal As New Microsoft.Exchange.WebServices.Data.FolderId(Microsoft.Exchange.WebServices.Data.WellKnownFolderName.Calendar, New Microsoft.Exchange.WebServices.Data.Mailbox("username@domain.local"))
        Dim _calendarView As New Microsoft.Exchange.WebServices.Data.CalendarView(DateTime.Now, DateTime.Now.AddDays(1))
        Dim apptCounter = 0

        For Each appointmentItem As Microsoft.Exchange.WebServices.Data.Appointment In myService.FindAppointments(_cal, _calendarView)
            apptCounter = apptCounter + 1
            Response.Write(appointmentItem.Subject)
            Response.Write("<br>")
            Response.Write(appointmentItem.Start.ToString & vbTab & appointmentItem.Duration.ToString)

            Response.Write("<br>")
            Response.Write(apptCounter)
        Next

Open in new window

0
 
LeeDerbyshireCommented:
You mean something that looks like the OWA calendar display?  Yes, you'd need to do all the layout yourself (<table/>s, etc,) once you'd got the data from Exchange.  It won't supply a nicely formatted calendar for you unless you use the existing web parts (which is basically what I was suggesting with the <iframe/>s), but then you can't get it to do the custom behaviour you are looking for.
0
 
gregbrainerdAuthor Commented:
Yes that was what I was trying to avoid. Okay, I appreciate your help :)
0
 
LeeDerbyshireCommented:
No problem.  Come back if you get stuck.  You can still add comments to this thread.
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now