4D-Exchange Concepts
The use of objects
This component relies heavily on the (not so) new 4d variable types C_OBJECT.
The 2 most used objects are the
- ItemObject
and theĀ
- ParameterObject
The different objects explained:
ItemObject
This one is the most important object we use in this component.
It represents an Item from the Exchange store and keeps all related information of that item in one handy place.
ItemObjects are expected my most methods that directly handle item data and they are created by either retrieving items from exchange or by creating new ones, either trough the Quick or Create commands or through EWS_ItemCreateStump.
The ItemObject holds information on how it was created by retaining the last SOAP envelope and Response items used, it holds errors as well as information on data changes. It also keeps all 4D XML DOM References in one handy place.
A typical ItemObject looks somewhat like this:
{
"ItemId": "AAM....=",
"SOAP_Action": "GetItem",
"SOAP_Envelope": "<?xml version=\"1.0\"....</soap:Envelope>\r",
"SOAP_Response": "HTTP/1.1 ....</s:Envelope>",
"XmlRef_ResponseMessage": "14F0833017C8CB50",
"ResponseClass": "Success",
"ItemType": "Contact",
"ChangeKey": "EQAAABYAAAAkNQEJKoHgSaTyc/uQcD3zAABYFzHg",
"XmlRef_ItemReference": "16DF447017C6E438"
}
There are obviously minimum requirements for an ItemObject as to what it contains. These are:
- ItemType
the type of item in the object, i.E. Contact, Message, etc. - ItemId
the Id of the item (will be empty when creating a new item) - ChangeKey
The ChangeKey of the item (will also be empty when creating a new item) - XmlRef_ItemReference
Xml Dom reference string for the actual item Xml
ParameterObject
A Parameter object contains the actual payload for what you intend to do, its contents depends on what you are doing, thus a parameter object for a calendar item will look slightly different from a contact item, and lets to get into other uses right here, as I will explain all of them in the appropriate places in this documentation.
The use of xml
As EWS works with XML and that XML is quite tedious to parse and manipulate, we use a special XML path notation in order to be able to pass identifying attributes within the path to specific elements in the XML of an item.
Read all about our groundbreaking work in handling XML element paths here:
Error handling
Error handling is crucial when communicating with Exchange Web Services, so we have devised some quite neat ways to deal with these, get enlightened here: