ChnageKey and ItemId.Id Change when we change The room's mail adress ? We need Unique and constant Identifiers

HI ,

I 'm new to developpement using the Exchange 2007 API , we have Rooms (each room has its mail adress) we create reservation in every room in exchange using the API and C# :

CalendarItemType appointment = new CalendarItemType();
           
            #region Add item properties to the appointment.
            appointment.Importance = ImportanceChoicesType.High;
            appointment.ImportanceSpecified = true;
            appointment.ItemClass = "IPM.Appointment";
            appointment.Subject = calendarInfo.Objet;
            #endregion

            #region Add calendar properties to the appointment.
            appointment.Start = calendarInfo.DateHeureDebutEx;
            appointment.StartSpecified = true;
            appointment.End = calendarInfo.DateHeureFinEx;
            appointment.EndSpecified = true;
            appointment.Location = calendarInfo.Location;
            appointment.LegacyFreeBusyStatus = MeetingStatusToLegacyFreeBusy(calendarInfo.Status);
            //il faut spcifier que la statut a t modifi. Le LegacyFreeBusyStatusSpecified doit tre  TRUE 
            //pour que le statut soit pris en charge par Exchange.
            appointment.LegacyFreeBusyStatusSpecified = true;
            appointment.Sensitivity = NiveauConfidentialiteToSensitivity(calendarInfo.NiveauConfidentialite);
            appointment.SensitivitySpecified = true;

            #endregion
	    #region Paramtrage du rpertoire destination (la Salle , The Room)
            DistinguishedFolderIdType folder = new DistinguishedFolderIdType();
            folder.Id = DistinguishedFolderIdNameType.calendar;
            folder.Mailbox = new EmailAddressType();
            folder.Mailbox.EmailAddress = calendarInfo.Salle.Email;
            folder.Mailbox.RoutingType = "SMTP";
            #endregion


            #region Prparation de la requte et cration de l'lment dans le calendrier
            // tableau des demandes
            NonEmptyArrayOfAllItemsType arrayOfItems = new NonEmptyArrayOfAllItemsType();
            arrayOfItems.Items = new ItemType[1];

            // ajout de l'lment  crer dans le tableau
            arrayOfItems.Items[0] = appointment;

            // cration de la requte  envoyer au serveur
            CreateItemType createItemRequest = new CreateItemType();

            // obligatoire pour la cration d'un lment dans le calendrier
            createItemRequest.SendMeetingInvitations = CalendarItemCreateOrDeleteOperationType.SendToNone;
            createItemRequest.SendMeetingInvitationsSpecified = true;

            // ajout du rpertoire
            createItemRequest.SavedItemFolderId = new TargetFolderIdType();
            createItemRequest.SavedItemFolderId.Item = folder;

            createItemRequest.Items = arrayOfItems;

            CreateItemResponseType createItemResponse = new CreateItemResponseType();

            OrionExchangeProxyClient oepc = new OrionExchangeProxyClient(web);


            
            // cration de l'lment et rcupration de la rponse du serveur dans l'objet CreateItemReponseType
            oepc.CreateItem(null, oepc.Ssct, oepc.MailboxCulture, oepc.Rsv, new TimeZoneContextType(), createItemRequest, out createItemResponse);
            
            #endregion

            #region Initialiser le CalendrierInfo avec l'id et le changeKey
            ResponseMessageType[] rmta = createItemResponse.ResponseMessages.Items;
            ItemInfoResponseMessageType rmt = (ItemInfoResponseMessageType)rmta[0];

            // grer les erreurs retourner par Exchange
            if (rmt.ResponseClass == ResponseClassType.Error)
            {
                throw new EwsException(String.Format(CultureInfo.CurrentCulture, "{0}: {1}", rmt.ResponseCode, rmt.MessageText));
            }

            ArrayOfRealItemsType itemArray = rmt.Items;
            ItemType item = itemArray.Items[0];
            calendarInfo.IdExchange = item.ItemId.Id;
            calendarInfo.ChangeKey = item.ItemId.ChangeKey;


            #endregion

Until now all works fine we could create reservation in exchange , we have another code to retreive reservation for each room based on chnageKey and ItemId.Id ,  but we noticed that when we change the mail adress of the room the ChangeKey and ItemId.Id values of all our reservations Changed !!!

I googled and i found that this two params ( ChangeKey and ItemId.Id)  are unique but not constant they change every time the adress mail of the room change !! can we keep them constant ?

we need to use a unique and constant params so when we create reservation in exchnage we can retreive them based on this params or unique identifiers.

Any Help would be great :)


  • Edited by bouhmid86 Thursday, August 27, 2015 8:12 AM
August 27th, 2015 8:11am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics