Upload de ficheros a una carpeta en Sharepoint
Buenas tardes
Estoy intentando hacer upload de ficheros en una carpeta de SharePoint utilizando HttpClient(), el token que uso es valido ya que me funciona descargando ficheros, el código es el siguiente:
Dim HClientSubida = New System.Net.Http.HttpClient()
URL = "https://graph.microsoft.com/v1.0/groups/032b56h................
HClientSubida.DefaultRequestHeaders.Authorization = New System.Net.Http.Headers.AuthenticationHeaderValue(Token)
HClientSubida.DefaultRequestHeaders.Accept.Add(New MediaTypeWithQualityHeaderValue("application/json"))
HClientSubida.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json; charset=utf-8")
dim strNombre="C:\prueba.pdf"
dim NombreArchivo="prueba.pdf"
dim CC as stream
CC=file.OpenRead
Dim conten = New MultipartFormDataContent()
conten.Headers.ContentType.MediaType = "application/json"
conten.Add(New System.Net.Http.StreamContent(CC), "Prueba", NombreArchivo)
Dim body1 As Object
body1 = JsonConvert.SerializeObject(conten)
Dim probando As HttpContent
probando = New StringContent(JsonConvert.SerializeObject(body1), UTF8Encoding.UTF8, "application/json")
Dim response4 = New HttpResponseMessage
response4 = Await HClientSubida.PostAsync(URL, probando)
Obtengo respuesta 400 y no se por donde tirar, agradezco enormemente cualquier ayuda . Gracias
StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
1 answer
Sort by: Most helpful
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more