Deletes a user's files and directories from the local cache. Deleting a container item implies deletion of all its contained items, recursively.
HRESULT DeleteItemsForUser( LPCWSTR pszUser, LPCWSTR *rgpszPaths, ULONG cPaths, DWORD dwFlags, BOOL bAsync, IOfflineFilesSimpleProgress *pIProgress );
Text string identifying the user for which the files are to be deleted for. This option is available only to administrators on the local computer. The text string may be the user's SID in string format or the user's domain\user logon name string.
Array of pointers, each to a fully qualified UNC path of a file or directory to be deleted.
Number of paths in rgpszPaths.
Flags controlling the behavior of the delete operation. This parameter can be one or more of the following values.
Do not delete automatically cached items. The default behavior is to delete automatically cached items.
Do not delete pinned items. The default behavior is to delete pinned items.
Delete even if locally modified in the cache. The default behavior is to not delete files with unsynchronized local changes.
Allows administrators to enumerate and delete all files regardless of access rights. If this flag is set and the caller is not an administrator, the function fails.
Indicates whether the operation is to be performed asynchronously. If this parameter is TRUE, the operation is scheduled for asynchronous operation and the function returns immediately. If this parameter is FALSE, the function returns when the operation is complete.
Interface to an event sink that will receive progress events during the operation. If events are not desired, this parameter can be NULL. Providing an event sink is highly recommended for asynchronous operation. A progress implementation is the only way to be notified when the asynchronous operation completes.
Returns S_OK if successful, or an error value otherwise.
HRESULT_FROM_WIN32(ERROR_CANCELLED) if the operation is canceled.
HRESULT_FROM_WIN32(ERROR_MORE_DATA) if errors occurred during the operation. Use the IOfflineFilesSimpleProgress::ItemResult callback method to detect errors as they occur.
The caller must have sufficient access to the files and directories to be deleted.
If a delete operation is canceled while in progress, changes to files processed to that point are not rolled back.
If a delete operation on a directory cannot remove all of its contained files or directories (for example, if access is denied), the specified directory entry is not removed. Any files and directories deleted up to that point remain deleted.
Files are deleted only from the local cache. Associated files on the network server are not affected.
Files deleted are not recoverable through the Recycle Bin. Files deleted must be recached to be available offline.
If only one path is provided in the rgpszPaths parameter and that path is to a single file, the return value indicates the result of that single delete operation. Otherwise, the caller must implement the progress callback methods in the following list and monitor the IOfflineFilesSimpleProgress::ItemResult method to obtain the result for each processed file and directory.
|Progress Events Interface||Method||Description|
|IOfflineFilesProgress||Begin||Called at the start of the operation.|
|IOfflineFilesSyncProgress||SyncItemBegin||Called at the start of processing for each file.|
|IOfflineFilesSyncProgress||SyncItemResult||Called after each file is deleted.|
|IOfflineFilesProgress||QueryAbort||Called periodically during the sync operation to detect a request for cancellation.|
|IOfflineFilesProgress||End||Called at the end of the operation.|
|Windows version||Windows Vista Windows Server 2008|