Поделиться через


RenameItem method of the Win32_OfflineFilesCache class

Renames an item in the cache. This method logs a request with Offline Files for a path to be renamed on the next system restart.

Syntax

uint32 RenameItem(
  [in] string  OriginalPath,
  [in] string  NewPath,
  [in] boolean ReplaceIfExists
);

Parameters

OriginalPath [in]

Fully qualified UNC path of the item (server, share, file or directory) to be renamed.

NewPath [in]

The new path to replace OriginalPath if the item that OriginalPath points to exists in the cache.

ReplaceIfExists [in]

This parameter is reserved for future use.

Return value

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

Remarks

This method is most often used after a directory tree has been renamed or moved on a remote server.

This method requires system administrator privilege.

Note

A restart of the system is necessary for the rename operation to be applied to the Offline Files cache.

This method fails if the path referenced by the NewPath parameter already exists in the Offline Files cache.

Beginning with Windows 7 with Service Pack 1 (SP1) and Windows Server 2008 R2 with Service Pack 1 (SP1) you can also use the RenameItemEx method to rename an item. It does not require system administrator privilege or a system restart. However, it will fail if the item is currently in use.

Requirements

Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Namespace
Root\CIMv2
MOF
OfflineFilesWmiProvider.mof
DLL
CscObj.dll

See also

Win32_OfflineFilesCache

RenameItemEx