In an automation script I need to update a ReservationInstance.
For example:
var reservationInstance = new DataMiner.Net.ResourceManager.Objects.ReservationInstance(new TimeRangeUtc(utcStartTime, utcEndTime))
{
ID = bookingGuid,
};
the End property of the reservationInstance is a read only, so how do I change the end time of this existing reservation so it can be updated via the resourceManagerHelper class?
Note: this is not a booking created via the Booking Manager of SRM. It is created via the resourceManagerHelper class:
resourceManagerHelper.AddOrUpdateReservationInstances(reservation);
Hi Mieke,
You can use the NewTimeRange method, to change the time of your reservation
(as mentioned by Sebastiaan).
E.g.
TimeRangeUtc bookingTimeRange = new TimeRangeUtc(newStart, newEnd, TimeZoneInfo.Local);
reservationInstance = reservationInstance.NewTimeRange(bookingTimeRange);
rmHelper.AddOrUpdateReservationInstances(reservationInstance)
Do note that if you have any events in your reservation, you'll have to remove all events first (using reservationInstance.RemoveEvent(...)), then use the NewTimeRange method and afterward add the events again (using reservationInstance.AddEvent(...)).
I believe you have a 'NewTimeRange' method on a ReservationInstance object to change the start and/or end of a reservation.
After calling this method, you still need to update the reservation instance using the resource manager in order to make your change persistent.