Share via

DeleteItems method of the Win32_OfflineFilesCache class

Deletes files and directories from the local cache. Deleting a container item implies the deletion of all its contained items, recursively.


uint32 DeleteItems(
  [in] string Paths[],
  [in] uint32 Flags


Paths [in]

Array of strings, each of which contains the qualified UNC path of a file or directory to be deleted.

Flags [in]

Flags controlling the behavior of the delete operation. This parameter can be one or more of the following values.

OfflineFilesDeleteFlagNoAutoCached (0x00000001)

Do not delete automatically cached items. The default behavior is to delete automatically cached items.

OfflineFilesDeleteFlagNoPinned (0x00000002)

Do not delete pinned items. The default behavior is to delete pinned items.

OfflineFilesDeleteFlagDelModified (0x00000004)

Delete files even if files are locally modified in the cache. The default behavior is to not delete files with unsynchronized local changes.

OfflineFilesDeleteFlagAdmin (0x80000000)

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.

Return value

This method returns either a WMI return code or a system error code.


The caller must have sufficient access to the files and directories to be deleted.

If a delete operation is canceled while the deletion operation is 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 will remain deleted.

Files are deleted only from the local cache. Associated files on the network server are not affected.

Files that are deleted are not recoverable through the Recycle Bin. Files that are deleted must be re-cached to be available offline.


Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008

See also