IFileSyncProvider::Initialize
Initializes a new instance of IFileSyncProvider that is based on the folder to synchronize and other settings.
HRESULT Initialize(
REFGUID guidReplicaId,
LPCWSTR pcszReplicaRootPath,
LPCWSTR pcszMetadataFilePath,
LPCWSTR pcszTempDirectoryPath,
DWORD dwSyncFlags,
IFileSyncScopeFilter *pScopeFilter,
IFileSyncProviderCallback *pCallback,
LPCWSTR pcszPathToSaveConflictLoserFiles);
Parameters
- guidReplicaId
[in] The ID of the replica.
- pcszReplicaRootPath
[in, string] The absolute path to the local file store for this provider. This is the folder that contains the files and subfolders to be synchronized.
- pcszMetadataFilePath
[in, string] The absolute path and file name of the metadata storage file. The directory must be created before this constructor is called. The application must ensure this directory is secured with the appropriate level of security permissions to prevent information disclosure.
- pcszTempDirectoryPath
[in, unique, string] The absolute path on which temporary files will be stored. The directory must be created before this constructor is called. The application must ensure this directory is secured with the appropriate level of security permissions to prevent information disclosure. If pcszTempDirectoryPath is NULL or an empty string, temporary files will be stored in the location specified by pcszReplicaRootPath.
- dwSyncFlags
[in] Flags that determine the behavior of the provider during synchronization. This value must be a combination of values from the FILESYNC_INIT_FLAGS enumeration.
- pScopeFilter
[in, unique] A static scope filter that specifies which files or directories in the local file store are included in the scope. Can be NULL.
- pCallback
[in, unique] A callback interface that receives progress and status notifications from the provider. Can be NULL.
- pcszPathToSaveConflictLoserFiles
[in, string] The absolute path on which files that are conflict losers will be stored. The directory must be created before calling this constructor. To help prevent information disclosure, the application must ensure that this directory is secured with the appropriate level of security permissions. Can be NULL.
Return Value
S_OK.
SYNC_E_FSP_INVALIDOPERATION if Initialize has already been called.
E_INVALIDARG when any of the specified paths are relative paths or do not exist, or when the metadata path does not include the metadata file name.
SYNC_E_METADATA_REPLICA_IN_USE when an instance of IReplicaMetadata that represents the replica ID specified by guidReplicaId and the metadata store specified by pcszMetadataFilePath already exists in another process.
Remarks
Information that is passed to the constructors is used for initialization and is set for the life of the provider instance. This means that, when any changes are made to these settings, a new instance of the provider must be created. For example, to change the scope filter that is being used for synchronization, a new file synchronization provider must be created and initialized with the new filter.
The file synchronization provider uses the metadata storage service to store all synchronization metadata in a lightweight database. The metadata database is one file. This file can be stored with the files and folders to be synchronized or in another location that is specified in Initialize.
To ensure proper security, directories such as the temp directory must be secured with the appropriate level of permissions to prevent information disclosure.