Synchronize method of the Win32_OfflineFilesCache class
Synchronizes files and directories in the Offline Files cache with their corresponding copies in the applicable network shared folders.
Syntax
uint32 Synchronize(
[in] string Paths[],
[in] uint32 Flags
);
Parameters
-
Paths [in]
-
Array of strings, each of which contains the fully qualified UNC path of a file or directory to be synchronized.
-
Flags [in]
-
Flags to control the behavior of the entire sync operation. Behaviors such as sync direction (in, out), the pinning of LNK targets, and the pinning of new files, are controlled through these flags. The following list describes the meaning of each flag.
-
OfflineFilesSyncControlFlagFillSparse (0x00000001)
-
Fill sparse files in the cache. Setting this flag results in an enumeration of the local copies in the cache. Any sparsely cached files that are found are filled so that they are no longer sparse. Sparsely cached files are not available for offline use. For more information, see the Sparse property of the Win32_OfflineFilesItem class.
-
OfflineFilesSyncControlFlagSyncIn (0x00000002)
-
Sync remote changes from the server to the local cache. Setting this flag automatically sets the OfflineFilesSyncControlFlagFillSparse flag as well.
-
OfflineFilesSyncControlFlagSyncOut (0x00000004)
-
Sync changes from the local cache to the server.
-
OfflineFilesSyncControlFlagPinNewFiles (0x00000008)
-
Pin new files found on the server inside pinned directories. This flag is ignored if the OfflineFilesSyncControlFlagSyncIn flag is not set.
-
OfflineFilesSyncControlFlagPinLinkTargets (0x00000010)
-
Applicable only if the OfflineFilesSyncControlFlagPinNewFiles flag is set. Normally, when a shell link (type LNK) is pinned, its target is not automatically pinned. When this flag is set, pinning a LNK file automatically pins its target if the target is a file. If the target is a directory, the target is never pinned automatically.
-
OfflineFilesSyncControlFlagPinForUser (0x00000020)
-
Applicable only if the OfflineFilesSyncControlFlagPinNewFiles flag is set. Pins the items for the calling user. This is the flag typically set for a caller of this method. It is important to note that Offline Files does not support a true per-user notion of pinning. When an item is pinned for a user, it is pinned for all users of that machine. However, the ability to access that pinned file depends on the user's access rights to that file computed while online.
-
OfflineFilesSyncControlFlagPinForUser_Policy (0x00000040)
-
Applicable only if the OfflineFilesSyncControlFlagPinNewFiles flag is set. Pins the items for per-user policy. This differs from the OfflineFilesSyncControlFlagPinForUser flag in that this flag cannot be modified by the user through the Offline Files user interface. Internally, Offline Files sets this flag when items are pinned by its Group Policy extension.
-
OfflineFilesSyncControlFlagPinForAll (0x00000080)
-
Applicable only if the OfflineFilesSyncControlFlagPinNewFiles flag is set. Pins the items for all users of the local machine. While the pinned state applies to all users, the ability to access a pinned file depends on the user's access rights to that file computed while online.
-
OfflineFilesSyncControlFlagLowPriority (0x00000200)
-
This flag is reserved for future use.
-
OfflineFilesSyncControlFlagAsyncProgress (0x00000400)
-
Progress is reported to the progress interface asynchronously with the actual operations. If this flag is not set, progress is reported synchronously with each operation.
-
OfflineFilesSyncControlFlagInteractive (0x00000800)
-
Set this flag if the operation is allowed to display user interface elements as necessary. An example is the system's credential-request dialog.
-
OfflineFilesSyncControlFlagConsole (0x00001000)
-
All interactions are directed to the console.
-
OfflineFilesSyncControlFlagSkipSuspendedDirs (0x00002000)
-
Set this flag if you want the sync operation to not sync suspended directory trees. It is recommended that this flag is set when the sync operation has not been invoked interactively and intentionally by a user.
-
OfflineFilesSyncControlFlagBackground (0x00010000)
-
Set this flag if you want the sync operation to avoid sharing violations in the event that an application opens a file that is currently open for the sync operation. When that scenario occurs and this flag is set, the sync operation will "back off" and not finish for that particular file at that time. This flag is primarily used by the Offline Files service for internal operations.
Note that OfflineFilesSyncControlCrKeepLocal, OfflineFilesSyncControlCrKeepRemote, and OfflineFilesSyncControlCrKeepLatest are not flag values. If you want all sync conflicts to be resolved in a "keep local", "keep remote" or "keep latest" manner, set one (and only one) of the following values to specify a conflict resolution policy. If no conflict resolution policy is specified, conflicts will remain unresolved and may be viewed in the Sync Center Conflicts folder.
OfflineFilesSyncControlCrKeepLocal (0x10000000)
Resolve all conflicts by copying the local computer copy to the server.
OfflineFilesSyncControlCrKeepRemote (0x20000000)
Resolve all conflicts by copying the server copy to the local computer.
OfflineFilesSyncControlCrKeepLatest (0x30000000)
Resolve all conflicts by copying with the latest last-change time. This resolution is sometimes called "last writer wins."
Return value
This method returns either a WMI return code or a system error code.
Remarks
To monitor progress, implement a WMI event sink to receive SWbem.OnProgressevent notifications. The strMessage parameter contains a text string that is encoded with the following colon-delimited format:
Reason:Result:ResultText:[Path]
-
Reason
-
Specifies the type of progress notification as one of the following values:
- 0: Begin; sent once at the start of the operation.
- 1: End; sent once at the end of the operation.
- 2: ItemBegin; sent at the start of processing each item.
- 3: ItemResult. Sent at the end of processing each item.
-
Result
-
Specifies an HRESULT value. If the sync operation succeeds, this value is zero.
-
ResultText
-
Specifies a Windows message text string to be associated with the Result value.
-
Path
-
A string containing the UNC path of the item. This is an empty string if Reason is zero (Begin) or 1 (End).
If a sync operation is canceled while in progress, files that have been synchronized up to that point will remain synchronized.
Requirements
Minimum supported client |
Windows Vista |
Minimum supported server |
Windows Server 2008 |
Namespace |
Root\CIMv2 |
MOF |
|
DLL |
|