Exchaneg web services - adding multiple attendees RRS feed

  • Question

  • i am using exchange web services for creating a meeting as a delegate user on someone's behalf , the code is woking fine but i want to add meeting particpants using some for or for each loop . The collection RequiredAttendees does not have a add method where i can add participants. Kinldy look at the code in bold(which i know is wrong as it is adding only the last particpant. The  particpants list is in meetingparticipants variable sepearted by "," operator. Kindly provide some solution for this


      System.Net.ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf scrt)
        Dim esb As ExchangeWS.ExchangeServiceBinding = New ExchangeWS.ExchangeServiceBinding()
        esb.RequestServerVersionValue = New ExchangeWS.RequestServerVersion()
        esb.RequestServerVersionValue.Version = ExchangeWS.ExchangeVersionType.Exchange2007_SP1
        esb.Credentials = New NetworkCredential("""")
        esb.Url = "***"
        ' Create the request and specify how the item is handled.
        Dim Request As ExchangeWS.CreateItemType = New ExchangeWS.CreateItemType()
        Request.MessageDisposition = ExchangeWS.MessageDispositionType.SendAndSaveCopy
        Request.MessageDispositionSpecified = True
        Request.SendMeetingInvitations = ExchangeWS.CalendarItemCreateOrDeleteOperationType.SendToAllAndSaveCopy
        Request.SendMeetingInvitationsSpecified = True
        ' Identify the principal's Calendar folder as the target folder for the calendar item.
        Dim defCalendarFolder As ExchangeWS.DistinguishedFolderIdType = New ExchangeWS.DistinguishedFolderIdType()
        defCalendarFolder.Id = ExchangeWS.DistinguishedFolderIdNameType.calendar
        defCalendarFolder.Mailbox = New ExchangeWS.EmailAddressType()
        defCalendarFolder.Mailbox.EmailAddress = masterAccount
        Dim target As ExchangeWS.TargetFolderIdType = New ExchangeWS.TargetFolderIdType()
        target.Item = defCalendarFolder
        ' Add the destination folder to the request.
        Request.SavedItemFolderId = target
        ' Create the calendar item 
        Dim calendarItem As ExchangeWS.CalendarItemType = New CalendarItemType()
        calendarItem.Subject = meetingSubject
        calendarItem.Body = New ExchangeWS.BodyType()
        calendarItem.Body.BodyType1 = ExchangeWS.BodyTypeType.HTML
        calendarItem.Body.Value = meetingBody
        calendarItem.Start = startDate
        calendarItem.StartSpecified = True
        calendarItem.End = endDate
        calendarItem.EndSpecified = True
        calendarItem.LegacyFreeBusyStatus = ExchangeWS.LegacyFreeBusyType.Busy
        calendarItem.LegacyFreeBusyStatusSpecified = True
           Dim attendee1 As New ExchangeWS.AttendeeType
        Dim i As Integer = 0
        For Each e In meetingParticipants.Split(",")
          attendee1 = New ExchangeWS.AttendeeType()
          attendee1.Mailbox = New ExchangeWS.EmailAddressType()
          attendee1.Mailbox.EmailAddress = e
          calendarItem.RequiredAttendees = New AttendeeType() {attendee1}
        ' Add the calendar item to the request.
        Request.Items = New ExchangeWS.NonEmptyArrayOfAllItemsType()
        Request.Items.Items = New ExchangeWS.ItemType() {calendarItem}
          ' Send the request and get the response.
          Dim Response As ExchangeWS.CreateItemResponseType = esb.CreateItem(Request)
          ' Get the response messsages.
          Dim rmta() As ExchangeWS.ResponseMessageType = Response.ResponseMessages.Items
          For Each rmt As ExchangeWS.ResponseMessageType In rmta
            Dim itemArray As ExchangeWS.ArrayOfRealItemsType = CType(rmt, ExchangeWS.ItemInfoResponseMessageType).Items()
            Dim Items() As ExchangeWS.ItemType = itemArray.Items
            ' Get the item identifier for the meeting.
            For Each item As ExchangeWS.ItemType In Items
              'Console.WriteLine("Item identifier: " + item.ItemId.Id);
          Return "Meeting Created Successfuly"
        Catch ex As Exception
          Return "Meeting cannot be created due to In-Sufficient Permission"
        End Try


    Thanks and Regards
    Kapil Yadav

    • Moved by Calvin_Gao Thursday, February 3, 2011 9:06 AM Move to appropriate forum (From:Visual Basic General)
    • Moved by John Saunders Thursday, February 3, 2011 7:08 PM exchange q (From:ASMX Web Services and XML Serialization)
    Tuesday, February 1, 2011 12:57 PM