0

I have a Python script that I've been running for months that uses shareplum to update various columns of a SharePoint List using UpdateListItems(kind = 'Update'). It has suddenly stopped working and I've no idea why. I don't get any error messages but the changes I am trying to make are not showing up. Creating a new item is working fine, it's only when I try to update an existing list item. I use the Office365 version of SharePoint.

The List is relatively large with over 500 list items and over 100 columns. The maximum List ID is 1050.

I tested it on another smaller list and it works OK, so it must be an issue with this particular List.

I'd be really grateful if someone could help. Since I'm not getting any error messages I don't know how to check what could be wrong with it.

from shareplum import Site
from shareplum import Office365
    

authcookie = Office365('https://XXX.sharepoint.com', username= XXX, password= XXX).GetCookies()
site = Site('https://XXX.sharepoint.com/sites/XXX', authcookie=authcookie)
list_ = site.List('TestList')

my_data = [{'ID': '3', 'Title': 'TestTitle'}]
list_.UpdateListItems(data=my_data, kind='Update')

UPDATE: I printed off the result of the response which says '0x80070057', 'Bad parameter passed to Web Server Extensions. Check the information you entered and try again.' I'm not sure if this helps identify what the issue could be?

I am now able to update my List items using Office365-REST-Python-Client instead of shareplum, but still love to know what the issue with shareplum is.

Kat hughes
  • 55
  • 1
  • 6

1 Answers1

0

Idk Python, but PowerShell/CSOM allows you to update the item after you have made the update. I'm assuming Shareplum is a wrapper for CSOM, so you should still have the ability to manually trigger the update.

I don't remember the code of the top of my head, but to manually update it it's something like this (in CSOM):

$listItem = get-pnplistitem -Identity 1 -list "Documents"
$listItem.Fields["Title"] = "New Title"
$listItem.Update()
$listItem.context.executeQuery() 
Zain
  • 1,246
  • 4
  • 15
  • 26
  • Thank you! I've never used PowerShell but I've found that the Office365-REST-Python-Client allows me to update my list items using the same method you showed me. I'll post an update in my original post. I'll keep this post open for a bit just in case someone is able to explain why shareplum stopped working for me. Thanks again. – Kat hughes Jun 16 '22 at 09:09