1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
Public Function Insertion(ByVal Requete As String, ByVal URLFichierEML As String) As String
Try
Dim Connexion As New ParametresExchange2
'Création d'une autorisation d'accès au serveur
Dim Autorisation As New System.Net.CredentialCache
Autorisation.Add(New System.Uri(Connexion.URLServeurExchange), "NTLM", New System.Net.NetworkCredential(Connexion.UserExchange, Connexion.MotDePasseExchange, Connexion.DomaineExchange))
'Création de la requête http
Dim PROPPATCHRequete As HttpWebRequest
PROPPATCHRequete = CType(HttpWebRequest.Create(URLFichierEML), HttpWebRequest)
PROPPATCHRequete.Credentials = Autorisation
PROPPATCHRequete.Method = "PROPPATCH"
PROPPATCHRequete.ContentType = "text/xml"
Dim bytes() As Byte
bytes = Text.Encoding.UTF8.GetBytes(Requete)
PROPPATCHRequete.ContentLength = bytes.Length
'Préparation de l'envoi de la requête entière dans un stream
Dim PROPPATCHRequeteStream As IO.Stream
PROPPATCHRequeteStream = PROPPATCHRequete.GetRequestStream()
PROPPATCHRequeteStream.Write(bytes, 0, bytes.Length)
PROPPATCHRequeteStream.Close()
'Récupération de la réponse
Dim PROPPATCHReponse As WebResponse
PROPPATCHReponse = CType(PROPPATCHRequete.GetResponse(), HttpWebResponse)
PROPPATCHReponse.Close()
Return URLFichierEML
Catch ex As Exception
End Try
Return URLFichierEML
End Function |
Partager