shareplum icon indicating copy to clipboard operation
shareplum copied to clipboard

Can't GetListItems when view name contains swedish characters

Open mgzon opened this issue 4 years ago • 2 comments

Hi,

I'm having problem with the code below.

authcookie = Office365('https://contoso.sharepoint.com', username='[email protected]', password='secret').GetCookies() site = Site('https://contoso.sharepoint.com/sites/mysite', authcookie=authcookie) mylist = site.List('mylist') mydata = mylist.GetListItems(u'Sök')

i get shareplum.errors.ShareplumRequestError: Shareplum HTTP Post Failed : 500 Server Error: Internal Server Error for url: https://contoso.sharepoint.com/sites/mysite/_vti_bin/lists.asmx

when i replace the view name with something that doesn't contain swedish characters it works fine. if i don use 'u' infront of the view name i get the same error.

Any ideés?

Regards Mattias Gustafsson

mgzon avatar Feb 23 '21 16:02 mgzon

Can you do this and let me know what it says? mylist.GetListItems(u'Sök') print(mylist.last_request)

I need to know how the SOAP request is being created. Also could you try changing your version to SharePoint2016 and see if you get the same issue?

jasonrollins avatar Feb 24 '21 01:02 jasonrollins

I did this since an exceptions is thrown. try: mydata = mylist.GetListItems(u'Sök') except: print(mylist.last_request)

and it responds.

SOAP-ENV:Body ns1:GetListItems ns1:listNamemylist</ns1:listName> ns1:viewNameThe Correct View GUID</ns1:viewName> ns1:rowLimit0</ns1:rowLimit> </ns1:GetListItems> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

Setting version=Version.v2016 gives the same error and last_request respond: site = Site('https://contoso.sharepoint.com/sites/mysite', version=Version.v2016, authcookie=authcookie)

SOAP-ENV:Body ns1:GetListItems ns1:listNamemylist</ns1:listName> ns1:viewNameThe Correct View GUID</ns1:viewName> ns1:rowLimit0</ns1:rowLimit> </ns1:GetListItems> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

The complete error trace is

Traceback (most recent call last): File "C:\Users\MattiasGustafsson\AppData\Local\Programs\Python\Python38\lib\site-packages\shareplum\request_helper.py", line 17, in post response.raise_for_status() File "C:\Users\MattiasGustafsson\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\models.py", line 940, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://contoso.sharepoint.com/sites/mysite/_vti_bin/lists.asmx

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File ".....\getInfo.py", line 116, in mydata = mylist.GetListItems(u'Sök') File "C:\Users\MattiasGustafsson\AppData\Local\Programs\Python\Python38\lib\site-packages\shareplum\list.py", line 259, in get_list_items response = post(self._session, File "C:\Users\MattiasGustafsson\AppData\Local\Programs\Python\Python38\lib\site-packages\shareplum\request_helper.py", line 20, in post raise ShareplumRequestError("Shareplum HTTP Post Failed", err) shareplum.errors.ShareplumRequestError: Shareplum HTTP Post Failed : 500 Server Error: Internal Server Error for url: https://contoso.sharepoint.com/sites/mysite/_vti_bin/lists.asmx

mgzon avatar Feb 24 '21 06:02 mgzon