How to: Enable Multi-Resource Appointments
- 2 minutes to read
To enable your end-user with assigning multiple resources to an appointment, set the AppointmentStorageBase.ResourceSharing property to true. With this option, the appointment editing form displays the AppointmentResourcesEdit control. It facilitates selecting multiple resources for the appointment by checking them in the list.
The data field mapped to the AppointmentMappingInfo.ResourceId property should be of a string type to store the XML text with information on assigned resources. Ensure that its length is enough to accommodate the text so you can set its type to nvarchar(max).
Starting with v15.2, the identifier property values in the Appointment, Resource and AppointmentDependency classes are of the Object type. To properly serialize them to the XML format, Base64 encoding is used by default. To switch back to the former serialization mechanism, set the static property SchedulerCompatibility.Base64XmlObjectSerialization to false.
An XML string for an appointment with two assigned resources is shown below.
The static Base64XmlObjectSerialization property is set to false.
<ResourceIds> <ResourceId Type="System.Int32" Value="1"/> <ResourceId Type="System.Int32" Value="4"/> </ResourceIds>
The static Base64XmlObjectSerialization property is set to true (default).
<ResourceIds> <ResourceId Value="~Xtra#Base64AAEAAAD/////AQAAAAAAAAAGAQAAAAE0Cw==" /> <ResourceId Value="~Xtra#Base64AAEAAAD/////AQAAAAAAAAAGAQAAAAExCw==" /> </ResourceIds>
To serialize and de-serialize appointments, use the AppointmentCollection.WriteXml and AppointmentCollection.ReadXml methods. However, you are advised to work with appointment data sources and corresponding data objects instead.