Hello,
I'm trying to add an item to Sharepoint list from local excel file and I made a macro that works in Windows 10 but does not work under Windows 7.
I get Http.status 500 (Internal Server error) in debug window when i execute macro on Windows 7.
Anyone has a suggestion how to make this works in Windows 7?
Macro Below:
Thank you in advance.
I'm trying to add an item to Sharepoint list from local excel file and I made a macro that works in Windows 10 but does not work under Windows 7.
I get Http.status 500 (Internal Server error) in debug window when i execute macro on Windows 7.
Anyone has a suggestion how to make this works in Windows 7?
Macro Below:
Code:
Sub ShPointUpload()
Dim objXMLHTTP As MSXML2.XMLHTTP
Dim strListNameOrGuid As String
Dim strBatchXml As String
Dim strSoapBody As String
Dim ListName As String
Dim SharepointUrl As String
Dim FieldNameVar As String
Dim SrBroj As String
Dim Kesh As String
ListName = "" (here goes my list name)
SharepointUrl = "" (here goes my Sharepoint site)
SrBroj = ActiveCell.Value
Kesh = ActiveCell.Offset(0, 2).Value
Set objXMLHTTP = New MSXML2.XMLHTTP
strListNameOrGuid = ListName
'Add New Item'
strBatchXml = "Here goes strbach info, which data i insert in which column (like FieldName, Value of that field, etc)"
objXMLHTTP.Open "POST", SharepointUrl + "_vti_bin/Lists.asmx", False
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=""UTF-8"""
objXMLHTTP.setRequestHeader "SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/UpdateListItems"
strSoapBody = "<soap:envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" "="" _
& "xmlns:xsd='http://www.w3.org/2001/XMLSchema' " _
& "xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'><soap:body><updatelistitems "="" _
& "xmlns='http://schemas.microsoft.com/sharepoint/soap/'><listname>" & strListNameOrGuid _
& "</listname><updates>" & strBatchXml & "</updates></updatelistitems></soap:body></soap:envelope>"
objXMLHTTP.Send (strSoapBody)
If objXMLHTTP.Status = 200 Then
'MsgBox "Sharepoint entry created successfully."
Debug.Print (objXMLHTTP.Status)
End If
Set objXMLHTTP = Nothing
'MsgBox Application.UserName
End Sub
Thank you in advance.
Last edited: