IPWorks Cloud 2020 Delphi Edition

Questions / Feedback?

ListChanges Method

Lists changes to resources and shared drives.

procedure ListChanges();

Remarks

This method lists changes to resources and shared drives.

General Usage

When this method 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. This method causes the ChangeList event to fire once for each change, and will also populate the Change* properties.

If there are still more changes available to list when this method returns, the ChangeMarker property will be populated. Continue to call this method until ChangeMarker is empty to accumulate all pages of results in the Change* properties. (Once 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.

Example of Listing Changes

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

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

Shared Drive Functionality

When working in the context of shared drives, there are additional properties that can be configured to specify what kinds of changes should returned.

If SharedDrive is empty string, then changes for items in shared drives that the user has accessed will be included (in addition to the usual changes for the user's items). Changes to the shared drives themselves which the user is a member of will also be included.

If SharedDrive is populated with a shared drive resource Id, then only changes to items within that shared drive, as well as changes to that shared drive itself, will be returned.

A change's Type will reflect whether it is associated with a file or folder (0), or a shared drive itself (1).

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Cloud 2020 Delphi Edition - Version 20.0 [Build 8265]