Pins files, directories, and network shared folders. Pinning is called "Always Available Offline" in the Windows user interface.
When a file is pinned, it is cached in the local Offline Files store. Unlike files that are automatically cached, pinned files are protected from automatic eviction when additional cache space is needed.
[in] string Paths,
Array of strings, each of which contains the qualified UNC path of a file or directory to be pinned.
Controls the behavior of the pin operation. May be one or more of the following flags.
Fills the item in addition to pinning it. This results in the item being fully cached as part of the pin operation. If this flag is not set, the item is only pinned and must wait to be filled by some other means of synchronization. Note that the Offline Files service periodically fills files in the background. If immediate offline availability is not necessary, it may be better (performance-wise) to not set this flag and let the service fill the file in the background.
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.
Pins the items for the calling user. This is the flag typically set for a caller of this function. 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. An item that is pinned with this flag can be unpinned by any user who has access to that file. The ability to access that pinned file depends on the user's access rights to that file computed while online.
Pins the items for per-user policy. This differs from the OfflineFilesPinControlFlagForUser 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.
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.
Reserved for future use.
Progress is reported to the progress interface asynchronously with respect to the actual operations. If this flag is not set, progress is reported synchronously with each operation.
Set this flag if the operation is allowed to display user interface elements as necessary. An example is the system's credential-request dialog.
This flag is ignored if the OfflineFilesPinControlFlagInteractive flag is not set. If the OfflineFilesPinControlFlagInteractive flag is set, this flag indicates that any UI produced should be directed to the console window associated with the process invoking the operation.
Set this flag if you want the pin operation to avoid sharing violations in the event that an application wishes to open a file that is currently open for the pin operation. When that scenario occurs and this flag is set, the pin 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.
If one or more of the paths provided refers to a directory or shared folder, this argument indicates whether all children (files and subdirectories) are to be pinned as well. If this parameter is TRUE, all children are pinned recursively. If this parameter is FALSE, only the directory itself is pinned, not its children. When the next synchronization operation occurs, all children are pinned recursively.
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:
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.
Specifies an HRESULT value. If the pin operation succeeds, this value is zero.
Specifies a Windows message text string to be associated with the Result value.
A string containing the UNC path of the item. This is an empty string if Reason is zero (Begin) or 1 (End).
If a pin operation is canceled while in progress, files that have been pinned up to that point will remain pinned.