0

Is there a direct way to copy a file from a SharePoint library to an Ftp location?

Currently, I'm able to download the document to a local directory using the OpenBinaryDirect method, however this only seems to take local paths, and not ftp://

Similarly, I can upload the file to ftp from a local directory using FtpWebRequest, however it cant I can't use a http:// source as a string or variable.

This snippet downloads the file to a local directory:

var fileStream = new FileStream(@"C:\%localpath%\file.doc", FileMode.Create); f.Stream.CopyTo(fileStream);

This snippet permits me to upload to an ftp location:

StreamReader sourceStream = new StreamReader(@"C:\%localpath%\file.doc");

I'd like to reference the sharepoint https source directly using OpenBinaryDirect or reference the ftp destination using FtpWebRequest.

Edit: HttpWebRequest has the same limitations as FtpWebRequest;

2

Why don´t you use "OpenBinary" Methode of SPFile, hold the stream in Memory and save it to the ftp-Server?

  • FtpWebRequest seems to only accept local file parameters - it doesn't appear to accept variables. – Oxossi Aug 18 '15 at 14:31
  • As I can on the MSDN-page of ftpwebrequest, they are reading a local file into a stream and Hand this stream to the ftpwebrequest. sou you should be able to Hand over a stream, no matter where it Comes from. – Leopold Lerch Aug 19 '15 at 6:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.