IBackgroundCopyFile3::SetValidationState method

Sets the validation state of this file.

Syntax

HRESULT SetValidationState(
  [in] BOOL State
);

Parameters

  • State [in]
    Set to TRUE if the file content is valid, otherwise, FALSE.

Return value

The method returns the following return values.

Return code Description
S_OK

Success

E_PENDING

You cannot validate the file until the download is complete.

BG_E_RECORD_DELETED

The cached record associated with this file has been deleted.

 

Remarks

If you set the validation state to FALSE and the file was downloaded from the origin server, the job moves to the error state with an error code of BG_E_VALIDATION_FAILED and the file progress is set to zero. You can then call the IBackgroundCopyJob::Resume method to download the file again.

Note  Do not call the IBackgroundCopyJob::Resume method to download the file again. Instead, call the IBackgroundCopyJob::Complete or IBackgroundCopyJob::Cancel method to cleanup the current job and then create a new job to download the file.

 

If you set the validation state to FALSE and the file was downloaded from a peer, DO removes the file from the cache, resets the file progress to zero, and downloads the file again from the origin server.

You can call this method only after DO finishes transferring the file.

Calling the IBackgroundCopyJob::Complete method implicitly validates the file.

If you validate a file in the cache and then call IBackgroundCopyJob4::SetPeerCachingFlags to disable caching (or peer caching is disable through Group Policy), the file remains in the cache. If you disable caching before validating the file, DO removes the file from the cache.

Requirements

Minimum supported client

Windows 10, version 1709 [desktop apps only]

Minimum supported server

Windows Server 2016 [desktop apps only]

Header

Deliveryoptimization.h

IDL

DeliveryOptimization.idl

Library

Dosvc.lib

DLL

Dosvc.dll

IID

IID_IBackgroundCopyFile3 is defined as 659cdeaa-489e-11d9-a9cd-000d56965251

See also

IBackgroundCopyFile3

IBackgroundCopyFile3::GetValidationState