Completing and Canceling a Job
To complete a transfer job, call the IBackgroundCopyJob::Complete method. For download jobs, you can call the Complete method before all files in the job have been transferred (before the job's state is BG_JOB_STATE_TRANSFERRED). Only those files that BITS successfully transferred to the client before you called the Complete method are available to the user.
For upload jobs, call the Complete method only if the job's state is BG_JOB_STATE_TRANSFERRED. To determine when the job's state is BG_JOB_STATE_TRANSFERRED, poll the job's state property or register to receive BG_NOTIFY_JOB_TRANSFERRED event notification.
To cancel a transfer job, call the IBackgroundCopyJob::Cancel method. The Cancel method removes the job from the transfer queue and removes the temporary files from the client. Typically, you call this method if you are unable to resolve an error associated with the job.
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.
If you do not call the Complete method or the IBackgroundCopyJob::Cancel method within 90 days (default JobInactivityTimeout Group Policy), the service cancels the job. If the service cancels the job, the downloaded files and the reply file are not available to the client; job cancellation does not affect files that have been successfully uploaded. You should always call the Complete or the Cancel method and not rely on the JobInactivityTimeout policy to cleanup your jobs. Jobs left in the queue may prevent users from creating other jobs if the MaxJobsPerUser or MaxJobsPerMachine policy limit is reached.
Build date: 11/12/2012