IBackgroundCopyJob::Cancel method (bits.h)

Deletes the job from the transfer queue and removes related temporary files from the client (downloads) and server (uploads).

Syntax

HRESULT Cancel();

Return value

This method returns the following HRESULT values, as well as others.

Return code Description
S_OK
Job was successfully canceled.
BG_S_UNABLE_TO_DELETE_FILES
Job was successfully canceled; however, the service was unable to delete the temporary files associated with the job.
BG_E_INVALID_STATE
Cannot cancel a job whose state is BG_JOB_STATE_CANCELLED or BG_JOB_STATE_ACKNOWLEDGED.

Remarks

You can cancel a job at any time; however, the job cannot be recovered after it is canceled.

For upload jobs, if the server is unavailable, there may be a delay before BITS deletes the job from the queue. BITS periodically sends a cancel request to the BITS server for up to 24 hours. If the server does not respond within the 24-hour period, BITS removes the job from the queue. If the no-progress time-out period is less than 24 hours, BITS uses the no-progress time-out period to limit the retries.

The Cancel method cancels an upload if the upload is not complete. If the upload is complete and the job is of type BG_JOB_TYPE_UPLOAD_REPLY, the method cancels the reply.

Requirements

Requirement Value
Minimum supported client Windows XP
Minimum supported server Windows Server 2003
Target Platform Windows
Header bits.h
Library Bits.lib
DLL QmgrPrxy.dll

See also

IBackgroundCopyJob::Complete

IBackgroundCopyJob::Resume

IBackgroundCopyJob::Suspend