This page has moved. You will be automatically redirected to its new location in 10 seconds. If you aren't forwarded to the new page, click here.

Search This Blog

Wednesday, January 13, 2010

Document Library to FTP Upload

 

Private Sub onWorkflowActivated1_Invoked(ByVal sender As System.Object, ByVal e As System.Workflow.Activities.ExternalDataEventArgs)
       Try
                   Dim request As FtpWebRequest = CType(WebRequest.Create(ConfigurationManager.AppSettings("FTPHost") + Me.workflowProperties.Item.File.Name), FtpWebRequest)
           request.Method = WebRequestMethods.Ftp.UploadFile
           request.Credentials = New NetworkCredential(ConfigurationManager.AppSettings("FTPUser"), ConfigurationManager.AppSettings("FTPPassword"))
           Dim webCl As WebClient = New WebClient()
           webCl.Credentials = New NetworkCredential(ConfigurationManager.AppSettings("SPUser"), ConfigurationManager.AppSettings("SPPassword"))
           Dim buffer() As Byte = webCl.DownloadData(ConfigurationManager.AppSettings("CurrentSite") + Me.workflowProperties.Item.File.Url)
           request.GetRequestStream().Write(buffer, 0, buffer.Length)
           request = Nothing
       Catch ex As Exception

       End Try

   End Sub

No comments:

Post a Comment