How to add events to a shared calendar in exchange server using web service? RRS feed

  • Question

  • I want to my asp.net web application with exchange server calendar .I could achieve this using webservice.
    My application is a leavemanagement system of an office. If manager approve a leave i want to display that leave details on every employees calendar. Now i could add the details in the approving persons calendar. But i couldnt implement shared calendar. could you please help me to achieve this my using EWS.
    my code is given below

      Dim esb As New ExchangeServiceBinding
      esb.Credentials = System.Net.CredentialCache.DefaultCredentials
     esb.PreAuthenticate = True
        ' Create the appointment.
       Dim appointment As New CalendarItemType()

    But when  i use the below code

      Dim esb As New ExchangeServiceBinding
      esb.Credentials = New NetworkCredential("testroombox", "Password12!", "domainname") '
     esb.PreAuthenticate = True

    I am getting the error The request failed with HTTP status 401: Unauthorized..
    How can i write to others calendar.? i could write in into my calendar by using my credentials.
    please help me to solve

    Friday, June 12, 2009 7:14 AM


  • To access another user's mailbox using EWS, you can use either Impersonation or Delegate Access.  Impersonation gives a service account all the rights of the account being impersonated -- i.e., the service account has the ability to "Act As" a user's account, with the ability to do anything and everything the user can do himself/herself within their own account. Delegate Access, on the other hand, gives you much tighter control over the rights being granted -- you can grant a specific type of rights in a specific location. For example, using Delegate Access you could grant UserA the ability to create items in UserB's Calendar folder.  Generally speaking, delegate access is the preferred option when the set of permissions you need to grant is accomplishable via delegate access (for a variety of reasons -- see David Sterling's posts within this thread for more info about delegate access vs impersonation).

    If you're using Exchange 2007 SP1 or Exchange 2010, then I'd recommend that you use the EWS Managed API -- the EWS Managed API 1.0 Beta SDK contains documentation for this API.

    If you're using Exchange 2007, then you can use the auto-generated proxy classes (using the EWS Managed API is not an option because it is not supported in Exchange 2007) -- documentation related to using the EWS proxy classes can be found in the Exchange Server 2007 SDK.

    In addition to the SDKs I've linked to, I'd suggest that you search this forum for "Impersonation" and for "Delegate Access" -- there are numerous posts that contain information and code examples related to these subjects.


    Programming Writer, Microsoft Exchange Developer Documentation Team
    • Proposed as answer by Kim Brandl Friday, June 12, 2009 10:46 PM
    • Marked as answer by Kim Brandl Monday, June 15, 2009 10:14 PM
    Friday, June 12, 2009 10:46 PM