ReadServiceObjectsCollectionFromXmlWithNamespace<TServiceObject extends ServiceObject> method

Future<List<TServiceObject>> ReadServiceObjectsCollectionFromXmlWithNamespace<TServiceObject extends ServiceObject>(
  1. XmlNamespace collectionXmlNamespace,
  2. String collectionXmlElementName,
  3. IGetObjectInstanceDelegate<TServiceObject> getObjectInstanceDelegate,
  4. bool clearPropertyBag,
  5. PropertySet? requestedPropertySet,
  6. bool summaryPropertiesOnly,
)
Reads the element value as date time, assuming it is unbiased (e.g. 2009/01/01T08:00) and scoped to service's time zone. Reads the element value as date time. The XML namespace. Name of the local. Reads the service objects collection from XML. Namespace of the collection XML element. Name of the collection XML element. The get object instance delegate. if set to [clear property bag]. The requested property set. if set to [summary properties only].

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;
}