5

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.

3
  • Has your connecting user account got enough rights to actually see/read the data? Update; there seem to be others with the same problem, no solution mentioned: social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/… Commented Oct 10, 2012 at 8:48
  • Yes, it has. Even I went through the link mentioned and felt the same as not to modify the stored procedure. Commented Oct 10, 2012 at 9:17
  • I agree on not modifying it. But in that case, I can't help you either. Sorry! Commented Oct 10, 2012 at 13:44

2 Answers 2

3
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.

3
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(); ChangeToken endToken; foreach(Change change in col) { endToken = change.ChangeToken;// endToken serves as next start token for further logs. // Do your stuffs here. } 

This can be the appropriate solution.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.