1

I have the following code to download a file by using its absolute path but the problem is that the stream I get is System.Io.Stream.NullStream.

If I modify the path I get the error:

"The remote server returned an error: (404) Not Found."

which means that the path that I'm using is correct.

I also tried removing the s from the https:// but its the same. Do you have any ideas what am I missing to get the file?

 Sub Main()

    Dim filename As New Uri("https://server/content/00008576/Project%20Documents/Workproductslist.xlsx")
    Dim server As String = filename.AbsoluteUri.Replace(filename.AbsolutePath, "")
    Dim serverrelative As String = filename.AbsolutePath

    Dim clientContext As New Microsoft.SharePoint.Client.ClientContext(server)
    Dim f As Microsoft.SharePoint.Client.FileInformation = Microsoft.SharePoint.Client.File.OpenBinaryDirect(clientContext, serverrelative)

  End Sub
  • Are you using it in SharePoint app? – Hardik Jun 29 '16 at 9:04
  • @Hardik I'm using it in a VB.NET application where I imported "Microsoft.SharePoint.Client.Runtime.dll" and "Microsoft.SharePoint.Client.dll" – UrsulRosu Jun 29 '16 at 10:43
  • Have you tried the methods mentioned in this link?...sharepoint.stackexchange.com/questions/62087/… – Hardik Jun 29 '16 at 11:06
  • @Hardik it is the method from that link that I have here, from the answer with 6 upvotes, but translated form C# to VB.NET. See I have the same variable names? – UrsulRosu Jun 29 '16 at 11:10

Your Answer

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

Browse other questions tagged or ask your own question.