SPChangeQuery.ContentType property

Gets or sets a Boolean value that specifies whether changes to SPContentType objects are included in the query.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public bool ContentType { get; set; }

Property value

Type: System.Boolean
true to include changes to content types; otherwise, false. The default is false.

The following example is a console application that queries the change log for all changes to content types in a site collection.

using System;
using Microsoft.SharePoint;

namespace Test
   class ConsoleApp
      static void Main(string[] args)
         using (SPSite siteCollection = new SPSite("http://localhost"))
            using (SPWeb webSite = siteCollection.RootWeb)
               // Set a limit on the number of changes returned on a single trip.
               query.FetchLimit = 500;
               SPChangeQuery query = new SPChangeQuery(false, true);

               // object type 
               query.ContentType = true;

               long total = 0;
               while (true)
                  SPChangeCollection changes = siteCollection.GetChanges(query);

                  total += changes.Count;

                  foreach (SPChangeContentType change in changes)
                     // Get the content type (if it still exists).
                     SPContentType contentType = 

                     // The change might have been to delete the content type.
                     string contentTypeName;
                     if (contentType == null)
                        contentTypeName = "Unknown";
                        contentTypeName = contentType.Name;

                     Console.WriteLine("\n{0} content type was changed on {1}.", 
                                       contentTypeName, change.Time.ToShortDateString());
                     Console.WriteLine("Type of change: {0}", change.ChangeType.ToString());

                  // Break out of loop if we have the last batch.
                  if (changes.Count < query.FetchLimit)
                  // Otherwise, go get another batch.
                  query.ChangeTokenStart = changes.LastChangeToken;

               Console.WriteLine("\nTotal changes = {0:#,#}", total);

         Console.Write("\nPress ENTER to continue...");