Webhook Success Key #3: Focus on SharePoint Changes That You Need
John E. Huschka, January 25, 2018
Azure Functions — Internet cloud based custom code for SharePoint and Office 365.
SharePoint Webhooks — Connections that allow us to attach custom code to SharePoint that is called when events occur.
This post is part of our blog series and demonstration code on achieving webhook success.
SharePoint tracks many changes on many objects. To avoid having to download and process unneeded change information, it is important that you query SharePoint for only the change information that you need.
The ChangeQuery class provides you with twenty-eight properties by which you can control the changes that SharePoint returns.
The first step in setting these properties is proper use of the ChangeQuery constructor, which provides two parameters:
public ChangeQuery( bool allChangeObjectTypes, bool allChangeTypes )
These two parameters are defined as follows:
allChangeObjectTypes: Provides the default value for ChangeQuery properties that control the object types for which changes are returned. Supplying true means that these properties will have a value of true. Meaning: Changes for all object types will be returned.
allChangeTypes: Provides the default value for ChangeQuery properties that control which change types are returned. Supplying true means that these properties will have a value of true. Meaning: All types of changes will be returned.
The table below shows each of ChangeQuery's twenty-eight properties along with the constructor parameter that provides its default value. Note that there is a parameter-less constructor for ChangeQuery that is equivalent to providing both parameters as false.
So, when you are querying SharePoint, set these properties to limit the returned changes to the minimum set required. We recommend calling the constructor with both parameters false and then setting individual properties appropriately for the changes that you need, which is what our QueueTransactionProcessor does:
The ChangeQuery class provides you with many options for limiting your query for SharePoint changes. Proper use will save you much processing logic and time.
More in our "Webhook Success Keys" series:
We at Collaboration Foundry are experts in SharePoint and Office 365. If you need assistance, we can help.
Contact us.
Also, don't forget to take a look at our
blog for more helpful tips and techniques.