0

This is my code to move files to sharepoint, but not compiling because it says the "CopyStream does not exist in current context". I already have reference to System.dll and the following namespaces:

using System.Security; 
using System.Net; 
using System.Net.Http;

...

public static void MoveFiles(string edifile, string Movetype, string editype, string csvfile)
{
    Uri destUri = new Uri("https://intranet.maxlinear.com/sales/SalesOp/Reports/B2B_POS");
    using (FileStream inStream = File.OpenRead(csvfile))
    {
        WebRequest req = WebRequest.Create(destUri);
        req.Method = "PUT";
        req.Credentials = CredentialCache.DefaultCredentials; // assuming windows Auth
        using (Stream outStream = req.GetRequestStream())                  
        {
            CopyStream(inStream, outStream);              
        }
    }
}

Am I missing anything else? Any help appreciated.

3
  • namespace: using System.Security; using System.Net; using System.Net.Http;
    – Tremor
    Commented Feb 20, 2018 at 21:13
  • could you simply write inStream.CopyTo(outStream);? see also stackoverflow.com/q/230128/1132334 Commented Feb 20, 2018 at 21:20
  • Thank you! it compiles now. Will test and see it if works.
    – Tremor
    Commented Feb 20, 2018 at 21:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.