How to cancel (abort) a background transfer after termination RRS feed

  • Question

  • After app resumes after termination, I am enumerating the pending downloads using GetCurrentDownloadsAsync() function.

    However, as I see, there is no Cancel() or Abort() in DownloadOperation class. How can I cancel or abort it?

    Tuesday, September 11, 2012 10:28 AM

All replies

  • Hi,

    Please check  this document DownloadOperation class has Pause and resume function.

    Please follow the Background Transfer sample

    Best regards,

    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, September 12, 2012 2:52 AM
  • That does not help at all. I do not want to pause/resume, I want to abort the pending download.

    No sample shows me how to do it. The task can be cancelled but here I don't have the task created, I have the enumerated DownloadOperation objects.

    I think there should be something like cancel or abort supported in DownloadOperation  class.

    Wednesday, September 12, 2012 6:41 AM
  • I am also facing this issue.

    MSDN states that (especially during debug) "your app should enumerate and then pause, resume, restart, or cancel any persisted downloads".

    However there is no indication how to cancel a background download.

    Any help is appreciated.

    Best regards


    Saturday, November 3, 2012 10:28 AM
  • async Task ScheduleMe() {
        this._downloadOperation = backgroundDownloader.CreateDownload(Uri, DownloadedFile);
        this._asyncDownload = this._downloadOperation.StartAsync();
        await this._asyncDownload;
    void CancelMe() {

    That's the basic idea.

    If you want to cancel everything upon activation:

            async Task CancelDownloadsAsync()
                IReadOnlyList<DownloadOperation> downloads = await BackgroundDownloader.GetCurrentDownloadsAsync();
                foreach (DownloadOperation download in downloads)

    • Proposed as answer by Jesse Jiang Friday, November 23, 2012 8:57 AM
    Thursday, November 22, 2012 2:07 AM