SharePointClientDownloadCompletedEventArgs Class

Summary

The SharePointClientDownloadCompletedEventArgs Class contains the data for the SharePointClient.DownloadCompleted event.

Syntax
C#
VB
C++
public class SharePointClientDownloadCompletedEventArgs : AsyncCompletedEventArgs 
  
Public Class SharePointClientDownloadCompletedEventArgs  
   Inherits System.ComponentModel.AsyncCompletedEventArgs 
public ref class SharePointClientDownloadCompletedEventArgs : public System.ComponentModel.AsyncCompletedEventArgs  

Remarks

The SharePointClient class supports downloading an item asynchronously through the DownloadFileAsync and GetDownloadStreamAsync methods. When you call these methods, control returns instantly to your program and the SharePointClient.DownloadCompleted event will occur when the download operation is completed. The event occurs whether or not the operation is successful.

Note: The SharePointClientDownloadCompletedEventArgs class derives from the standard .NET System.ComponentModel.AsyncCompletedEventArgs class and adds those properties needed to support downloading from a SharePoint server.

After the download finishes, the SharePointClient.DownloadCompleted event is fired with a SharePointClientDownloadCompletedEventArgs object containing the following information about the operation:

Property Value
SourceUri

The source URI. This is the same value as the sourceUri parameter passed to the DownloadFileAsync or GetDownloadStreamAsync method.

DestinationFileName

The destination file name. This is the same value as the destinationFileName parameter passed to the DownloadFileAsync method if that method was called to initiate the download. If the GetDownloadStreamAsync method was called to initiate the download, then the value of this property is null (Nothing in Visual Basic).

DestinationData

A SharePointClientDownloadData object that contains the download stream information if GetDownloadStreamAsync was called to initiate the download. If DownloadFileAsync was used to initiate the download, then the value of this property will be null (Nothing in Visual Basic)

Note that you are responsible for calling the System.IDisposable.Dispose method on the DestinationData property if you subscribe to the SharePointClient.DownloadCompleted event.

System.ComponentModel.AsyncCompletedEventArgs.Error

Gets a value that indicates which error occurred during the asynchronous download operation. If an exception is raised during the asynchronous download operation, the class will assign the exception to the System.ComponentModel.AsyncCompletedEventArgs.Error property. The client application's event-handler delegate should check the System.ComponentModel.AsyncCompletedEventArgs.Error property before accessing any properties in SharePointClientDownloadCompletedEventArgs.

The value of the System.ComponentModel.AsyncCompletedEventArgs.Error property is null (Nothing in Visual Basic) if the operation was canceled

System.ComponentModel.AsyncCompletedEventArgs.UserState

Gets the unique identifier for the asynchronous download operation. The value of this property is the same as the userState parameter passed to the DownloadFileAsync or GetDownloadStreamAsync method.

System.ComponentModel.AsyncCompletedEventArgs.Cancelled

true if the asynchronous download operation has been canceled; otherwise, false. This class does not change the value of this property from its default value of false.

Example

For an example, refer to DownloadFileAsync or GetDownloadStreamAsync.

Requirements

Target Platforms

Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.