IFileSyncProviderCallback::OnApplyingChange

Occurs when a file change application is about to be tried.

HRESULT OnApplyingChange(
  LPCWSTR pcszNewDirectoryPath,
  LPCWSTR pcszCurrentDirectoryPath,
  const WIN32_FIND_DATAW *pNewFileInfo,
  const WIN32_FIND_DATAW *pCurrentFileInfo,
  DWORD dwChangeType,
  BOOL *pfSkipChange);

Parameters

  • pcszNewDirectoryPath
    [in, string] The new path for the file to be changed. The path is relative to the root directory. If dwChangeType is FILESYNC_CHANGE_TYPE_DELETE, this value is NULL. If dwChangeType is FILESYNC_CHANGE_TYPE_RENAME, this is the new path after the new name is applied.
  • pcszCurrentDirectoryPath
    [in, string] The current path for the file to be changed. The path is relative to the root directory. If dwChangeType is FILESYNC_CHANGE_TYPE_CREATE, this value is NULL. If dwChangeType is FILESYNC_CHANGE_TYPE_RENAME, this is the current path before the new name is applied.
  • pNewFileInfo
    [in, unique] The new file data for the file to be changed. If dwChangeType is FILESYNC_CHANGE_TYPE_DELETE, this value is NULL. If dwChangeType is FILESYNC_CHANGE_TYPE_RENAME, this file data represents the file as it will be after the new name is applied.
  • pCurrentFileInfo
    [in, unique] The current file data for the file to be changed. If dwChangeType is FILESYNC_CHANGE_TYPE_DELETE, this value is NULL. If dwChangeType is FILESYNC_CHANGE_TYPE_RENAME, this file data represents the file as it currently is before the new name is applied.
  • dwChangeType
    [in] The type of change to be applied. This value is from the FILESYNC_CHANGE_TYPE enumeration.
  • pfSkipChange
    [out] Indicates whether this change should be skipped.

Return Value

  • S_OK

  • Application-specific error codes

Remarks

This event provides a mechanism for the application to dynamically skip changes during a synchronization session. To skip a change, set the value of pfSkipChange to TRUE. A change that is skipped will not be applied to the destination replica. An IFileSyncProviderCallback::OnChangeSkipped event will be fired with dwReason set to FILESYNC_SKIP_REASON_APPLICATION_REQUEST for each change that is skipped.

Some changes are tried more than one time during the course of a session. On each attempt, this event is fired. For example, an attempt is made to delete a folder. Because there is an existing file in the folder, the attempt fails. This folder delete operation will continue to be tried throughout the session until either the delete operation is successful or it is determined that the delete operation cannot occur during this session and is skipped.

This event will be raised only when a change affects file data on the destination replica and not when a change affects only the metadata for a file. For example, if an update-update conflict is detected and the file on the destination system is picked as the winner, no change is applied to the destination and this event will not be fired. Similarly, propagating a tombstone from the source to the destination causes only a metadata update and no change to the destination file system. In this case, this event will not be fired.

If OnApplyingChange returns an error, Sync Framework stops processing the current change batch and returns the error code from the ProcessChangeBatch method of IFileSyncProvider.

See Also

Reference

IFileSyncProviderCallback Interface
FILESYNC_CHANGE_TYPE Enumeration