[Video] Enforce SharePoint governance policies with Queries and Rules

In this video, we are going to show you one of the hidden gems of SPDocKit. As you all know, but let’s repeat, SharePoint governance refers to the set of policies and procedures you need to enforce to keep your SharePoint environment in good shape. Queries and rules help you to enforce your company policies across a SharePoint farm, such as enabling document versioning, finding checked-out files and examining other settings for document libraries or list levels, and much more. Let’s start!


Table of contents:
0:11 Queries and Rules Intro
1:04 Query No.1 – Checked Out Files
2:32 Query No.2 – Lists with Large Number of Items
3:23 Query No.3 – Document Versioning
4:34 Building a Query with SPDocKit
8:02 SPDocKit Rules – Use Case – Enable Document Versioning
11:16 How to create your own Rule?

The feature has two powerful and useful components. The first component is Queries, which allows you to query your SharePoint database to retrieve information about particular settings or stuff that has been going on inside your SharePoint. The other is Rules, which allows you to set some of these settings according to your company policies or other best practices that you might wanna configure.

Query Examples

To start, on the SPDocKit home screen, click on the Queries and Rules button. Let’s take a look at some examples that are built-in into SPDocKit:

  • Query No. 1 – Checked-Out Files: This query looks for all the checked-out files in your SharePoint. It helps you to detect if some files have been checked out for a long time, or if someone has left the company leaving some files checked out, which will prevent other people from making changes to them. After you run the query, these files will be listed on the screen. You are now able to explore. Click to open the location of a file and use the SharePoint interface to check it in.
  • Query No. 2 – Lists with a Large Number of Items: Here, we are looking for lists with more than 4500 items. This is very useful because SharePoint has a threshold of 5000 items, so this can be useful to detect if there are any large lists that could cause problems in the future. Inspect those lists and see if you can divide them into smaller ones.
  • Query No. 3 – Document Versioning: Let’s pretend that there is a company policy that says we need to enable document versioning for every single document library. You can enforce this via templates, but users could still revert the settings to disable document versioning. Use the query to find all the lists that have versioning disabled and then use a rule to enforce this company policy.

You can easily choose a target for your queries. You can query an entire farm or limit the query to one site collection, specific subsite etc.

Use Case – Enforce a Governance Policy for Document Versioning

Building a query is very simple using the SPDocKit wizard. It allows you to build a query without any specific knowledge of PowerShell or any other technology. The wizard will lead you through six simple steps:

  1. Enter a name for your query. Choose the appropriate scope (site collection, lists etc.).
  2. Choose the fields that are going to be shown on your report (title, URL etc.).
  3. Set up the sort order for the results (e.g. by title).
  4. Choose a trigger for running your query. One option is to run it automatically (scheduled) and another is manually.
  5. Select all the conditions that you want to apply.
  6. Choose a target (we needed one site collection for our demo).

We used Queries to check all the document libraries that have document versioning disabled. There are two libraries in our results – Marketing and Sales. If our company has a policy that says we need to enable document versioning for every single document library, the next step is to use Rules to solve this issue!

SPDocKit Guery - Document libraries with versioning disabled

Rules are set up using a wizard similar to that for Queries, with five quick steps. First, enter a name for your rule, then configure all the details you need (such as enable creating major versions, enter the number of versions you want to keep, require content approval, who can see the draft items etc.). Next, choose whether to run it automatically or manually. If there is a policy, it would be good to run it automatically. Let’s say every day. Then choose the filters and finally the target (skip this if you wish to set up the target each time you run the rule).

When we run the rule that we have configured, SPDocKit will show us that it has changed the values for two document libraries (Marketing and Sales) that were previously identified as problematic. Now when we click on our Sales document library and open the Library settings in SharePoint, we will see that versioning has been enabled with all the settings applied that we set up in the wizard. To confirm the results, go back to SPDocKit Queries and run the query again!

Document Versioning Rule - Results visible in SharePoint

Creating Your Own SharePoint Rules with SPDocKit

There are two scopes for rules – one is for lists and the other one is for subsites.

Wizard Scope: web applications, site collection(s), subsite(s), list(s) and libraries
Supported rule types:

  1. List Rules
    • Attachments – to specify if users can attach files to items in a list.
    • Dialogs – whether to launch a new, edit and display forms in the dialog.
    • Display on the quick launch – whether the documents will be displayed on the quick launch.
    • Document version history – whether a version is created each time you edit a file in a document library.
    • Folders – whether the “New Folder” command is available.
    • Item-level Permissions – specify which items user can read and edit.
    • Offline Client availability – whether this document library should be available for offline clients.
    • Opening Documents in the Browser – whether browser-enabled documents should be opened in the client or browser by default when user clicks on them.
    • Quick edit – whether Quick Edit can be used on this list to bulk edit data.
    • Rating Settings – whether or not items in a list can be rated.
    • Require Check Out – whether users must check out documents before making changes in this document library.
    • Search – list visibility in search results.
  2. Subsite Rules
    • Request Access Mail – specify an email address used for approving access requests for subsite.

Example: Say we want to create a rule that says “do now allow folders on document libraries”. Simply chose the option Folders and click that you do not want to allow this option. Then choose the trigger, filters and the target, and voila!

SPDocKit Rules - Folders



spdockit-trial