FileSyncProvider Class

Is a synchronous synchronization provider that can be used to synchronize files, folders, and subfolders in NTFS, FAT, or SMB file systems.

Namespace:  Microsoft.Synchronization.Files
Assembly:  Microsoft.Synchronization.Files (in Microsoft.Synchronization.Files.dll)

'Declaration
Public Class FileSyncProvider _
	Inherits UnmanagedSyncProviderWrapper _
	Implements IDisposable
'Usage
Dim instance As FileSyncProvider

The FileSyncProvider type exposes the following members.

  NameDescription
Public methodFileSyncProvider(String)Initializes a new instance of the FileSyncProvider class based on the specified root directory path.
Public methodFileSyncProvider(Guid, String)Initializes a new instance of the FileSyncProvider class based on the specified replica ID and root directory path.
Public methodFileSyncProvider(String, FileSyncScopeFilter, FileSyncOptions)Initializes a new instance of the FileSyncProvider class that is based on the specified root directory path, scope filter, and configuration options.
Public methodFileSyncProvider(Guid, String, FileSyncScopeFilter, FileSyncOptions)Initializes a new instance of the FileSyncProvider class that is based on the specified replica ID, root directory path, scope filter, and configuration options.
Public methodFileSyncProvider(String, FileSyncScopeFilter, FileSyncOptions, String, String, String, String)Initializes a new instance of the FileSyncProvider class that is based on the specified root directory path, scope filter, configuration options, metadata storage file path, metadata storage file name, temporary file path, and path to store conflict loser files.
Public methodFileSyncProvider(Guid, String, FileSyncScopeFilter, FileSyncOptions, String, String, String, String)Initializes a new instance of the FileSyncProvider class that is based on the specified replica ID, root directory path, scope filter, configuration options, metadata storage file path, metadata storage file name, temporary file path, and path to store conflict loser files.
Top

  NameDescription
Public propertyConfigurationGets the configuration settings for the provider. (Inherited from KnowledgeSyncProvider.)
Public propertyDestinationCallbacksGets an object that a synchronization application can use to register to receive notification of events that occur during synchronization. (Inherited from KnowledgeSyncProvider.)
Public propertyFileSyncOptionsGets the options that govern the behavior of the provider during synchronization.
Public propertyIdFormatsGets the schema that defines the format of various IDs that are used by the provider. (Overrides UnmanagedSyncProviderWrapper.IdFormats.)
Public propertyMetadataDirectoryPathGets the absolute path to the metadata storage file.
Public propertyMetadataFileNameGets the name of the metadata storage file.
Public propertyPreviewModeGets or sets a value that indicates whether the provider is in preview mode.
Public propertyReplicaIdGets the ID for the replica.
Public propertyRootDirectoryPathGets the absolute path to the local file store for this provider. This is the folder that contains the files and subfolders to be synchronized.
Public propertyScopeFilterGets the static scope filter that specifies which files or directories in the local file store are included in the scope.
Public propertyTempDirectoryPathGets the absolute path where temporary files will be stored.
Top

  NameDescription
Public methodBeginSessionNotifies the unmanaged provider that it is joining a synchronization session. (Inherited from UnmanagedSyncProviderWrapper.)
Public methodDetectChangesTriggers an enumeration of the local file system replica for changes, and updates the metadata appropriately.
Public methodDisposeReleases the unmanaged resources that are used by FileSyncProvider.
Protected methodDispose(Boolean)Releases the unmanaged resources that are used by FileSyncProvider and optionally releases the managed resources.
Public methodEndSessionNotifies the unmanaged provider that a synchronization session to which it was enlisted has finished. (Inherited from UnmanagedSyncProviderWrapper.)
Public methodEquals (Inherited from Object.)
Protected methodFinalizeFinalizer for FileSyncProvider. Releases all resources. (Overrides Object.Finalize.)
Public methodGetChangeBatchGets a batch of changes from the unmanaged provider. (Inherited from UnmanagedSyncProviderWrapper.)
Public methodGetFullEnumerationChangeBatchGets a batch of changes from the unmanaged provider as part of a full enumeration. (Inherited from UnmanagedSyncProviderWrapper.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetSyncBatchParametersGets the requested batch size and current knowledge for the scope from the unmanaged provider. (Inherited from UnmanagedSyncProviderWrapper.)
Public methodGetType (Inherited from Object.)
Public methodInitializeInitializes the wrapper so that it represents the specified unmanaged provider and uses the specified change data retriever adapter to convert between managed and unmanaged data retrievers. (Inherited from UnmanagedSyncProviderWrapper.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodProcessChangeBatchPasses a batch of changes to the unmanaged provider for processing. (Inherited from UnmanagedSyncProviderWrapper.)
Public methodProcessFullEnumerationChangeBatchPasses a batch of changes to the unmanaged provider for processing during a full enumeration. (Inherited from UnmanagedSyncProviderWrapper.)
Public methodToString (Inherited from Object.)
Top

  NameDescription
Public eventAppliedChangeOccurs when a file change has been applied.
Public eventApplyingChangeOccurs when a file change is about to be tried.
Public eventCopyingFileOccurs periodically to show progress while a file is being copied.
Public eventDetectedChangesOccurs when the change detection pass is complete.
Public eventDetectingChangesOccurs when a directory is about to be analyzed during a change detection pass.
Public eventSkippedChangeOccurs when a change is skipped.
Public eventSkippedFileDetectOccurs when a file or folder is not analyzed during change detection.
Top

To synchronize all files and subfolders in a directory, pass the replica ID and root directory to FileSyncProvider(Guid, String), and pass the provider to a SyncAgent object to handle the synchronization session.

By default, synchronization metadata is stored in a metadata storage service database file in the root directory of the replica. To customize the location and name of this file, specify these by using FileSyncProvider(Guid, String, FileSyncScopeFilter, FileSyncOptions, String, String, String, String).

Control over which files and folders are included in the synchronization scope can be accomplished by configuring a FileSyncScopeFilter and passing it to the provider's constructor. The filter contains properties that can be used to exclude a list of files, exclude a list of folders, exclude files and folders based on their attributes, and explicitly include a list of files.

A number of configuration options, FileSyncOptions, are available to control how the provider behaves during synchronization, for example, whether it moves deleted files to the recycle bin or deletes them permanently from the file system.

A variety of events are available to the application that wants to show progress or dynamically skip particular changes during the session.

The provider can be put into preview mode by setting PreviewMode to true before starting synchronization. While in preview mode, the provider will perform all actions as if a real synchronization session is occurring, including firing all events. However, the provider will not actually apply any changes to the destination replica.

NoteNote

Concurrent synchronization operations to the same file store are not supported. If another provider instance was previously initialized with the same replica (that is, the same values for directory path and metadata file path), but has not yet been released, the constructor will throw a ReplicaMetadataInUseException from the metadata store.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: