CreateEwsObjectFromXmlElementName<TServiceObject extends ServiceObject> static method
TServiceObject
CreateEwsObjectFromXmlElementName<TServiceObject extends ServiceObject>(
- ExchangeService? service,
- String xmlElementName
Implementation
static TServiceObject
CreateEwsObjectFromXmlElementName<TServiceObject extends ServiceObject>(
ExchangeService? service, String xmlElementName) {
// todo("implement CreateEwsObjectFromXmlElementName");
// print("CreateEwsObjectFromXmlElementName($xmlElementName);");
if (EwsUtilities
.serviceObjectInfo.Member!.XmlElementNameToServiceObjectClassMap
.containsKey(xmlElementName)) {
Type? itemClass = EwsUtilities.serviceObjectInfo.Member!
.XmlElementNameToServiceObjectClassMap[xmlElementName];
if (EwsUtilities
.serviceObjectInfo.Member!.ServiceObjectConstructorsWithServiceParam
.containsKey(itemClass)) {
CreateServiceObjectWithServiceParam creationDelegate = EwsUtilities
.serviceObjectInfo
.Member!
.ServiceObjectConstructorsWithServiceParam[itemClass!]!;
return creationDelegate(service) as TServiceObject;
} else {
throw new ArgumentException(
"Strings.NoAppropriateConstructorForItemClass");
}
} else {
throw ArgumentException("Can't instantiate $TServiceObject");
// return default(TServiceObject);
}
}