LEADTOOLS SharePoint Client (Leadtools.SharePoint.Client assembly)
LEAD Technologies, Inc

DownloadCompleted Event






An event that indicates an asynchronous download operation has been completed.
Syntax
'Declaration
 
Public Event DownloadCompleted As EventHandler(Of SharePointClientDownloadCompletedEventArgs)
'Usage
 
Dim instance As SharePointClient
Dim handler As EventHandler(Of SharePointClientDownloadCompletedEventArgs)
 
AddHandler instance.DownloadCompleted, handler
add_DownloadCompleted(function(sender, e))
remove_DownloadCompleted(function(sender, e))

Event Data

The event handler receives an argument of type SharePointClientDownloadCompletedEventArgs containing data related to this event. The following SharePointClientDownloadCompletedEventArgs properties provide information specific to this event.

PropertyDescription
Cancelled (Inherited from System.ComponentModel.AsyncCompletedEventArgs)Gets a value indicating whether an asynchronous operation has been canceled.
DestinationData Gets the download destination stream data.
DestinationFileName Gets the download operation destination file name.
Error (Inherited from System.ComponentModel.AsyncCompletedEventArgs)Gets a value indicating which error occurred during an asynchronous operation.
SourceUri Gets the URI of the source item being downloaded.
UserState (Inherited from System.ComponentModel.AsyncCompletedEventArgs)Gets the unique identifier for the asynchronous task.
Remarks

The SharePointClient class supports downloading an item asynchronously using the DownloadFileAsync and GetDownloadStreamAsync methods. When you call these methods, control returns instantly to your program and the Leadtools.SharePoint.Client.SharePointClient.DownloadCompleted event occurs when the download operation is completed (whether or not the operation was successful).

Note that the SharePointClientDownloadCompletedEventArgs derives from the standard .NET System.ComponentModel.AsyncCompletedEventArgs class and adds properties specified to SharePoint download support.

When the download operation is completed, the Leadtools.SharePoint.Client.SharePointClient.DownloadCompleted event will receive a SharePointClientDownloadCompletedEventArgs object containing the foolowing 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 DownloadFileAsync if this method was called to initiate the download. If GetDownloadStreamAsync 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 System.IDisposable.Dispose on DestinationData if you subscribe to the Leadtools.SharePoint.Client.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 assigns 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 the SharePointClientDownloadCompletedEventArgs class.

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 the default value of false

Example

For an example, refer to DownloadFileAsync or GetDownloadStreamAsync.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

SharePointClient Class
SharePointClient Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.