HttpClientConnection.DownloadFile(String, Boolean) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ServerURL プロパティで指定されたリソースからローカル ファイルにデータをダウンロードします。
public:
void DownloadFile(System::String ^ fileName, bool OverwriteDestination);
public void DownloadFile (string fileName, bool OverwriteDestination);
member this.DownloadFile : string * bool -> unit
Public Sub DownloadFile (fileName As String, OverwriteDestination As Boolean)
パラメーター
- fileName
- String
ダウンロードされたデータが格納されるローカル ファイルの名前です。
- OverwriteDestination
- Boolean
見つかった場合に既存のファイルを上書きするかどうかを示すブール値。 true の値を指定すると、既存のファイルが上書きされます。
例
次のコード例では、HttpClientConnection の作成方法を示し、ダウンロードに適した値を設定してから DownloadFile を呼び出します。 プロパティの値は、アプリケーションで有効な値に置き換える必要があります。
const string svcName = "Test_WebService";
string wsdlFile = Directory.GetCurrentDirectory() + @"\WebSvceTask_wsdl.wsdl";
//create HTTP connection
ConnectionManager httpConn = pkg.Connections.Add("HTTP");
HttpClientConnection clientConn = new HttpClientConnection(httpConn.AcquireConnection(null));
clientConn.UseProxy = true;
clientConn.ProxyURL = @"http://yourproxy";
clientConn.BypassProxyOnLocal = true;
clientConn.ServerURL = yourURL;
TaskHost th = (TaskHost)pkg.Executables.Add ("STOCK:WebServiceTask");
WebServiceTask task = (WebServiceTask)th.InnerObject ;
task.Connection = httpConn.Name;
task.ServiceName = svcName;
task.OutputType = DTSOutputType.Variable;
task.OutputLocation = "output";
clientConn.DownloadFile(wsdlFile, false);
task.WsdlFile = wsdlFile;
const String svcName = "Test_WebService"
Dim wsdlFile As String = Directory.GetCurrentDirectory() + "\WebSvceTask_wsdl.wsdl"
'create HTTP connection
Dim httpConn As ConnectionManager = pkg.Connections.Add("HTTP")
Dim clientConn As HttpClientConnection = New HttpClientConnection(httpConn.AcquireConnection(Nothing))
clientConn.UseProxy = True
clientConn.ProxyURL = "http://yourproxy"
clientConn.BypassProxyOnLocal = True
clientConn.ServerURL = yourURL
Dim th As TaskHost = CType(pkg.Executables.Add("STOCK:WebServiceTask"), TaskHost)
Dim task As WebServiceTask = CType(th.InnerObject, WebServiceTask)
task.Connection = httpConn.Name
task.ServiceName = svcName
task.OutputType = DTSOutputType.Variable
task.OutputLocation = "output"
clientConn.DownloadFile(wsdlFile, False)
task.WsdlFile = wsdlFile