Question

Below is the code:

        ClientContext context = new ClientContext("http://SPSite");
        context.Credentials = new NetworkCredential("user", "pwd", "domain");
        ChangeQuery cq = new ChangeQuery(true, true);                  
        ChangeCollection col = list.GetChanges(cq);            
        context.Load(col);
        context.ExecuteQuery();
        MessageBox.Show(col.Count.ToString());

Irrespective of the changes done, it always shows 0.

Was it helpful?

Solution

ClientContext context = new ClientContext("http://SPSite");
context.Credentials = new NetworkCredential("user", "pwd", "domain");
ChangeQuery cq = new ChangeQuery(true, true); 
cq.ChangeTokenStart = new ChangeToken();
cq.ChangeTokenStart.StringValue = "1;3;" + list.Id.ToString() + ";" + DateTime.UtcNow.AddHours(-1).Ticks.ToString() + ";-1";                 
ChangeCollection col = list.GetChanges(cq);            
context.Load(col);
context.ExecuteQuery();
MessageBox.Show(col.Count.ToString());

Even though I don't prefer creating token by yourself, this seems to be the only way which works as per my googling so far.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top