Cloud Storage Integrator 2016 Node.js Edition
Cloud Storage Integrator 2016 Node.js Edition
Questions / Feedback?

ListChanges Method

Lists changes for a user.

Syntax

googledrive.listChanges([callback])

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for this method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

This method lists changes to files that are available to a user. This can be used to check if any new changes are reported while working with a file. This allows you to be sure you are working with the most up to date version of a file.

When ListChanges is called, it will use the change marker stored in either ChangeMarker or NextChangeMarker (only one can be populated at a time) to request the next page of changes.

If there are more changes available to list after a call to ListChanges returns, the ChangeMarker property will be populated. If there aren't any more changes available to list, the NextChangeMarker property will be populated instead.

Calling GetCurrentChangeMarker will immediately populate NextChangeMarker. Regardless of whether it is populated because of a call to GetCurrentChangeMarker or to ListChanges, NextChangeMarker is always populated with a value that (at the time of population) points to the most current state. (Since "the most current state" implies that there are no further changes to list, calling ListChanges immediately after NextChangeMarker is populated will not return any further changes.)

Setting ChangeMarker to "1" will cause ListChanges to list changes beginning with the very first change available.

Calling this method will fire the ChangeList event once for each change, and also will populate the Change* properties.

Example of Listing Changes

// Start listing changes from the beginning, and list a maximum of 10 changes at a time.
gdrive.ChangeMarker = "1";
gdrive.Config("MaxResults=10");

// List changes once.
gdrive.ListChanges();
do {
  for (int i = 0; i < gdrive.Changes.Count; i++) {
    Console.WriteLine(gdrive.Changes[i].ResourceId);
    Console.WriteLine(gdrive.Changes[i].Time);
    Console.WriteLine(gdrive.Changes[i].Removed);
  }
  // Continue to call ListChanges() until ChangeMarker is the empty string (indicating there
  // are no more changes to list).
  gdrive.ListChanges();
} while (gdrive.ChangeMarker.Length > 0);

// Now NextChangeMarker will be populated. If we were to call ListChanges() again right now,
// nothing would be listed and NextChangeMarker would still be populated.

// Wait 2 minutes and then try to list changes again.
Thread.Sleep(120000);
gdrive.ListChanges();
do {
  for (int i = 0; i < gdrive.Changes.Count; i++) {
    Console.WriteLine(gdrive.Changes[i].ResourceId);
    Console.WriteLine(gdrive.Changes[i].Time);
    Console.WriteLine(gdrive.Changes[i].Removed);
  }
  gdrive.ListChanges();
} while (gdrive.ChangeMarker.Length > 0);

 
 
Copyright (c) 2019 /n software inc. - All rights reserved.
Cloud Storage Integrator 2016 Node.js Edition - Version 16.0 [Build 7239]