Webhook Success Key #3: Focus on SharePoint Changes That You Need

John E. Huschka, January 25, 2018

Target Audience:
SharePoint Developer
Technology:

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.

ChangeQuery Property
Definition
Default from Constructor Parameter
Specifies whether add changes are included.
allChangeTypes
Specifies whether changes to alerts are included.
allChangeObjectTypes
Specifies whether changes to content types are included.
allChangeObjectTypes
Specifies whether delete changes are included.
allChangeTypes
Specifies whether changes to site columns are included.
allChangeObjectTypes
Specifies whether changes to files are included.
allChangeObjectTypes
Specifies whether changes to folders are included.
allChangeObjectTypes
Specifies whether changes to groups are included.
allChangeObjectTypes
Specifies whether adding users to groups is included.
allChangeTypes
Specifies whether deleting users from the groups is included.
allChangeTypes
Specifies whether general changes to list items are included.
allChangeObjectTypes
Specifies whether changes to lists are included.
allChangeObjectTypes
Specifies whether move changes are included.
allChangeTypes
Specifies whether changes to the navigation structure of a site collection are included.
allChangeTypes
Specifies whether renaming changes are included.
allChangeTypes
Specifies whether restoring items from the recycle bin or from backups is included.
allChangeTypes
Specifies whether adding role assignments is included.
allChangeTypes
Specifies whether deleting role assignments is included.
allChangeTypes
Specifies whether adding role definitions is included.
allChangeTypes
Specifies whether deleting role definitions is included.
allChangeTypes
Specifies whether modifying role definitions is included.
allChangeTypes
Specifies whether modifications to security policies are included.
allChangeObjectTypes
Specifies whether changes to site collections are included.
allChangeObjectTypes
Specifies whether updates made using the item SystemUpdate method are included.
allChangeTypes
Specifies whether update changes are included.
allChangeTypes
Specifies whether changes to users are included.
allChangeObjectTypes
Specifies whether changes to views are included.
allChangeObjectTypes
Specifies whether changes to Web sites are included.
allChangeObjectTypes

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.


 


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.


Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
CAPTCHAThis question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
1 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.