ReadServiceObjectsCollectionFromXmlWithNamespace<TServiceObject extends ServiceObject> method
Future<List<TServiceObject> >
ReadServiceObjectsCollectionFromXmlWithNamespace<TServiceObject extends ServiceObject>(
- XmlNamespace collectionXmlNamespace,
- String collectionXmlElementName,
- IGetObjectInstanceDelegate<
TServiceObject> getObjectInstanceDelegate, - bool clearPropertyBag,
- PropertySet? requestedPropertySet,
- bool summaryPropertiesOnly,
Implementation
// DateTime ReadElementValueAsUnbiasedDateTimeScopedToServiceTimeZone()
// {
// String elementValue = this.ReadElementValue<String>();
// return EwsUtilities.ParseAsUnbiasedDatetimescopedToServicetimeZone(elementValue, this.Service);
// }
/// <summary>
/// Reads the element value as date time.
/// </summary>
/// <param name="xmlNamespace">The XML namespace.</param>
/// <param name="localName">Name of the local.</param>
/// <returns>Element value.</returns>
// DateTime ReadElementValueAsDateTime(XmlNamespace xmlNamespace, String localName)
// {
// return this.ConvertStringToDateTime(this.ReadElementValueWithNamespace(xmlNamespace, localName));
// }
/// <summary>
/// Reads the service objects collection from XML.
/// </summary>
/// <typeparam name="TServiceObject">The type of the service object.</typeparam>
/// <param name="collectionXmlNamespace">Namespace of the collection XML element.</param>
/// <param name="collectionXmlElementName">Name of the collection XML element.</param>
/// <param name="getObjectInstanceDelegate">The get object instance delegate.</param>
/// <param name="clearPropertyBag">if set to <c>true</c> [clear property bag].</param>
/// <param name="requestedPropertySet">The requested property set.</param>
/// <param name="summaryPropertiesOnly">if set to <c>true</c> [summary properties only].</param>
/// <returns>List of service objects.</returns>
Future<List<TServiceObject>> ReadServiceObjectsCollectionFromXmlWithNamespace<
TServiceObject extends ServiceObject>(
XmlNamespace collectionXmlNamespace,
String collectionXmlElementName,
IGetObjectInstanceDelegate<TServiceObject> getObjectInstanceDelegate,
bool clearPropertyBag,
PropertySet? requestedPropertySet,
bool summaryPropertiesOnly) async {
List<TServiceObject> serviceObjects = <TServiceObject>[];
TServiceObject? serviceObject = null;
if (!this.IsStartElementWithNamespace(
collectionXmlNamespace, collectionXmlElementName)) {
await this.ReadStartElementWithNamespace(
collectionXmlNamespace, collectionXmlElementName);
}
if (!this.IsEmptyElement) {
do {
await this.Read();
if (this.IsStartElement()) {
serviceObject =
getObjectInstanceDelegate(this.Service, this.LocalName);
if (serviceObject == null) {
await this.SkipCurrentElement();
} else {
if (this.LocalName != serviceObject.GetXmlElementName()) {
throw new ServiceLocalException(
"The type of the object in the store (${this.LocalName}) does not match that of the local object (${serviceObject.GetXmlElementName()}).");
}
await serviceObject.LoadFromXmlWithPropertySet(this,
clearPropertyBag, requestedPropertySet, summaryPropertiesOnly);
serviceObjects.add(serviceObject);
}
}
} while (!this.IsEndElementWithNamespace(
collectionXmlNamespace, collectionXmlElementName));
}
return serviceObjects;
}