I am using the Changes API to fetch changes:

ChangeQuery cq = new ChangeQuery(true, true);
cq.ChangeTokenStart = new ChangeToken();
cq.ChangeTokenStart.StringValue = string.Format("1;1;{0};{1};-1", site.Id, DateTime.Now.AddDays(-1).ToUniversalTime().Ticks.ToString());
cq.FetchLimit = 1000;
cq.RecursiveAll = false;
cq.GroupMembershipAdd = false;
cq.GroupMembershipDelete = false;
cq.RoleAssignmentAdd = false;
cq.RoleAssignmentDelete = false;
cq.RoleDefinitionUpdate = false;
cq.RoleDefinitionAdd = false;
cq.RoleDefinitionDelete = false;
cq.User = false;
cq.SystemUpdate = false;
cq.Group = false;
cq.SecurityPolicy = false;
cq.Update = false;
cq.Add = true;
cq.DeleteObject = false;
cq.Item = true;
cq.File = false;
cq.Folder = false;
cq.Alert = false;
cq.Web = false;
cq.LatestFirst = false;//Sorting

while (cq.ChangeTokenStart != null)
    var changes = context.Site.GetChanges(cq);
    Change lastChangeItem = null;

    foreach (Microsoft.SharePoint.Client.Change change in changes)
        Console.WriteLine(string.Format("Chnage is {0}", change.ChangeType));

        if (change is ChangeItem)
            ChangeItem changeItem = (ChangeItem)change;
            List list = context.Web.Lists.GetById(changeItem.ListId);
            Console.Write("List {0}", list.Id);

        lastChangeItem = change;

    if (lastChangeItem == null)
        cq.ChangeTokenStart = null;
        cq.ChangeTokenStart = lastChangeItem.ChangeToken;

But I'm getting errors when trying to do this. Some of the ChangeItem values refer to lists that do not exist:

The page you selected contains a list that does not exist.  It may have been deleted by another user.

I did not delete any lists during my test. Just added new site and some new documents to a document library.

So in summary, I'm getting "ghost" lists and list items that do not actually exist as far as I can tell.

What are these "ghost ChangeItem" values? where are they coming from and should I be doing something to filter them?


There are some hidden lists in SharePoint which are used internally. For example, User Information List (UIL) (although UIL will never get deleted). There is a chance that some hidden system-defined list was deleted automatically and that is why you are getting this error. Try some other site and see if you get the same error.

  • this sounds like the correct explanation to me. I'm not really sure though, but that aligns with what i was thinking was happening. – Nicholas DiPiazza Aug 13 '19 at 12:36

You're requesting changes from a site collection:

var changes = context.Site.GetChanges(cq);

And then trying to retrieve a list which is possibly located in another site from the current site:

List list = context.Web.Lists.GetById(changeItem.ListId);

So, first you must connect to the right site and then request a list from that site.

  • no I'm using the changeItem.webId to get the correct sharepoint web. this is not the issue. but thanks for taking the time. – Nicholas DiPiazza Aug 13 '19 at 12:36
  • You're iterating through the changes but do use the same instance of Web (context.Web) for each change while they could come from different webs. – Dmitry Kozlov Aug 13 '19 at 15:02
  • 1
    List list = context.Web.Lists.GetById(changeItem.ListId); - context.Web is the same for each change. – Dmitry Kozlov Aug 13 '19 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.