Cannot invoke HTTP DAV request. There is a pending query when downloading sp file

Getting this error on some files, 99% of the files get downloaded as expected but some files give this error.

Only common thing I can find with these files is that they all have embedded images in them. (yet others with embedded image  get downloaded correctly)

 Public Function DownloadMsgfileFromSP(context As SP.ClientContext, oListitem As SP.ListItem) As String

        Try
            Dim finfo As SP.FileInformation = Microsoft.SharePoint.Client.File.OpenBinaryDirect(context, oListitem.Item("FileRef"))
            Dim fs As New FileStream(fpTempFileFolder + "TEMP.MSG", FileMode.Create)
            finfo.Stream.CopyTo(fs)
            fs.Close()
            fs.Dispose()
            finfo.Dispose()
            Return fpTempFileFolder + "TEMP.MSG"
        Catch
            Return ""
        End Try

    End Function

Thanks in advance.
February 20th, 2014 2:53am

As an alternative I tried the following

 Public Function DownloadMsgfileFromSP(context As SP.ClientContext, oListitem As SP.ListItem) As String

        Try
            My.Computer.Network.DownloadFile(New Uri(context.Url & "\" & "Correspondence\" & oListitem.Item("FileLeafRef")), fpTempFileFolder + "TEMP.MSG", context.Credentials, True, 5000, True)
            Return fpTempFileFolder + "TEMP.MSG"
        Catch
            Return ""
        End Try

    End Function

Weirdly this fails on the same files with the exception

Unable to read data from the transport connection

I searched for this error, most say it has to do with the size but some of these messages are really small (<100Kb)


  • Edited by Rbie 3 hours 3 minutes ago
Free Windows Admin Tool Kit Click here and download it now
February 20th, 2014 3:58am

Some more information: Just ran a test on 25000 mail messages.

Fail rate: 1.1%

All messages that fail have attachments (either embedded or not)

message size of failed messages range from 58kb to 6.5 MB

messages that fail, all fail with both methods

February 20th, 2014 4:14am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics