Quantcast
Viewing all articles
Browse latest Browse all 27020

VS2010 - copy multiple files from SharePoint but wait for each to finish download

Hello,

I am trying to copy several files from sharepoint to local drive and i got some help on the code HERE.

I am using this code to copy several files:

vb.net Code:
  1. Dim credentials As System.Net.NetworkCredential = System.Net.CredentialCache.DefaultNetworkCredentials
  2.         Dim countries(0 To 4) As String
  3.         countries(0) = "AE"
  4.         countries(1) = "AN"
  5.         countries(2) = "AT"
  6.         countries(3) = "BA"
  7.         countries(4) = "JO"
  8.  
  9.         For index = 0 To countries.Length - 1
  10.             Dim source As New Uri("http://prime.sharepoint.sss.com/folderreport/" & "filecountry_" & countries(index) & "_Prices.zip")
  11.             Dim destination As String = "\\222.222.111.111\Testing_1\" & "filecountry_" & countries(index) & "_Prices.zip"
  12.             'My.Computer.Network.DownloadFile(source, destination, credentials, True, , False)
  13.             My.Computer.Network.DownloadFile(source, destination, credentials, True, 60000I, False)
  14.         Next

When i run the code it tries to copy all the file one after another without waiting for the previous one to finish and i end up with all files being incomplete.

What can i do to make the code wait for one file to finish downloading and then start the next one?
I tried several ways but apparently i know too little of .net and i cannot get it work.

Thank you for your support.

Danut

Viewing all articles
Browse latest Browse all 27020

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>