DavFlushFile function (davclnt.h)

Flushes the data from the local version of a remote file to the WebDAV server.

Syntax

DWORD DavFlushFile(
  [in] HANDLE hFile
);

Parameters

[in] hFile

A handle to an open file on a WebDAV server.

The file handle must have the GENERIC_WRITE access right. For more information, see File Security and Access Rights.

Return value

If the function succeeds, or if hFile is a handle to an encrypted file, the return value is ERROR_SUCCESS.

If the function fails, the return value is a system error code.

Remarks

When an application creates or opens a remote file on a WebDAV server, the WebDAV service downloads the file to the local computer, and the application receives a handle to the open file on the server. Any changes that the application makes to the local file have no effect on the remote file until the file handle is closed and the local version of the file is uploaded to the server. Because the file handle is closed at the same time that the file is saved to the server, the application cannot check whether the file was saved successfully.

To avoid this problem, use the DavFlushFile function to flush the data from the local version of the file to the remote file on the WebDAV server. If the function succeeds, this means that the file was saved successfully.

This function does not flush encrypted files. If hFile is a handle to an encrypted file, DavFlushFile returns ERROR_SUCCESS without flushing the file data.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header davclnt.h
Library Netapi32.lib
DLL Netapi32.dll

See also

CreateFile

FlushFileBuffers

OpenFile

WriteFile