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

  • Question

  • 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 spécifier 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 Paramètrage du répertoire 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 Préparation de la requête et création de l'élément dans le calendrier
                // tableau des demandes
                NonEmptyArrayOfAllItemsType arrayOfItems = new NonEmptyArrayOfAllItemsType();
                arrayOfItems.Items = new ItemType[1];
    
                // ajout de l'élément à créer dans le tableau
                arrayOfItems.Items[0] = appointment;
    
                // création de la requête à envoyer au serveur
                CreateItemType createItemRequest = new CreateItemType();
    
                // obligatoire pour la création d'un élément dans le calendrier
                createItemRequest.SendMeetingInvitations = CalendarItemCreateOrDeleteOperationType.SendToNone;
                createItemRequest.SendMeetingInvitationsSpecified = true;
    
                // ajout du répertoire
                createItemRequest.SavedItemFolderId = new TargetFolderIdType();
                createItemRequest.SavedItemFolderId.Item = folder;
    
                createItemRequest.Items = arrayOfItems;
    
                CreateItemResponseType createItemResponse = new CreateItemResponseType();
    
                OrionExchangeProxyClient oepc = new OrionExchangeProxyClient(web);
    
    
                
                // création de l'élément et récupération de la réponse 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];
    
                // gérer 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
    Thursday, August 27, 2015 8:11 AM

All replies