1

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.

user2246674
  • 7,621
  • 25
  • 28
Srikanth P Vasist
  • 1,327
  • 2
  • 14
  • 26
  • 1
    @varg How is `sharepoint-clientobject` not relevant here? – Rawling Oct 10 '12 at 07:41
  • @Rawling my fault, because the tag isn't really popular. reedited the keywords. – varg Oct 10 '12 at 07:58
  • 1
    There are server object model and client object mode. So, "sharepoint-clientobject" would be appropriate is what is feel. I am a newbie idon't know. – Srikanth P Vasist Oct 10 '12 at 08:01
  • I approve of sharepoint-clientobject. Both the "browser" SP-COM and the native SP-COM work the same way and share requirements/restrictions/approaches. – user2246674 Jul 20 '13 at 23:25

1 Answers1

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

Srikanth P Vasist
  • 1,327
  • 2
  • 14
  • 26
  • Also see http://sharepoint.stackexchange.com/questions/47519/how-to-get-changes-from-sp-server-2010-in-client-object-model – user2246674 Jul 21 '13 at 00:02
  • What does the "1;3;" indicate? – BrainSlugs83 Jul 01 '16 at 22:52
  • Looks like it indicates Version 1, and List -- more info is here: https://blogs.technet.microsoft.com/stefan_gossner/2009/12/04/content-deployment-the-complete-guide-part-7-change-token-basics/ – BrainSlugs83 Jul 01 '16 at 23:01