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
Dikesh Gandhi
  • 6,803
  • 4
  • 30
  • 55
UrsulRosu
  • 111
  • 1
  • Are you using it in SharePoint app? – Hardik Jun 29 '16 at 09: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?...http://sharepoint.stackexchange.com/questions/62087/how-to-get-a-file-using-sharepoint-client-object-model-with-only-an-absolute-url – 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

0 Answers0