Selecting Exchange Data
Note: The following describes the behavior when Schema is set to EWS. It has no impact on MSGraph.
FindItem vs. GetItem
By default, the driver will perform the Exchange Web Services FindItem API call and only request summary information about items when a SELECT operation is performed. Any request that could return more than one item will only return summary information. For example:SELECT ItemId, Surname, EmailAddress1 FROM Contacts WHERE Surname='Smith'
If you wish to request the contents of a message or more information about a contact or calendar event, you will need to set IncludeContent to TRUE, specify the ItemIds of the items, or limit your results to a single item. For example:
SELECT ItemId, Surname, EmailAddress1 FROM Contacts WHERE ItemId='AZQ111222...'OR
SELECT ItemId, Surname, EmailAddress1 FROM Contacts WHERE ItemdId IN ('AZQ111222...', 'AZQ111223...', 'AZQ111224...', 'AZQ111225...')OR
SELECT ItemId, Surname, EmailAddress1 FROM Contacts WHERE Surname='Smith' LIMIT 1
Public and Custom Folders
If you wish to read from a Public or Custom folder, you'll need to first identify the FolderId of the folder you wish to read from. This can be done by submitting a read query from the ParentFolder (for a custom folder) or from the relevant table for the type of object stored in a Public Folder, using Inbox if the Public Folder contains messages. For example:Finding the FolderId of a subfolder of the Inbox:
SELECT DisplayName, FolderId FROM InboxFinding the FolderId of a Custom Folder that contains Contacts:
SELECT DisplayName, FolderId FROM Contacts WHERE ParentFolderName='publicfoldersroot'
If your public folder is nested, you may need to do a separate SELECT query on the parent custom folder:
SELECT DisplayName, FolderId FROM Contacts WHERE ParentFolderId='AAEuAAAAAAAa...'