Office365-REST-Python-Client icon indicating copy to clipboard operation
Office365-REST-Python-Client copied to clipboard

Update URL field in a list - with execute_batch()

Open rheckly opened this issue 10 months ago • 0 comments

As soon as a I update an URL column, the execute_batch() doesn't work. I can update all items individually.

When I change e.g. only varchar column, then the execute_batch() works.

this works:

sptListItems = ctx.web.lists.get_by_id(sptListId)
    item = sptListItems.items.get_by_id(1).get().execute_query()
    # SharePoint speichert Hyperlinks als Dictionary mit "Url" und "Description"
    hyperlink = {'Url': "http://www.happy-pc.ch", 'Description': ""}

    # item.set_property("SPTURL", hyperlink).update().execute_query()
    item.set_property("SPTURL", hyperlink).update().execute_query()
    item = sptListItems.items.get_by_id(2).get().execute_query()
    hyperlink = {'Url': "http://www.happy-pc.ch/tester", 'Description': ""}
    item.set_property("SPTURL", hyperlink).update().execute_query()

this doesn't work with execute_batch():

sptListItems = ctx.web.lists.get_by_id(sptListId)
item = sptListItems.items.get_by_id(1).get().execute_query()
# SharePoint speichert Hyperlinks als Dictionary mit "Url" und "Description"
hyperlink = {'Url': "http://www.happy-pc.ch", 'Description': ""}

# item.set_property("SPTURL", hyperlink).update().execute_query()
item.set_property("SPTURL", hyperlink).update()
item = sptListItems.items.get_by_id(2).get().execute_query()
hyperlink = {'Url': "http://www.happy-pc.ch/tester", 'Description': ""}
item.set_property("SPTURL", hyperlink).update()
ctx.execute_batch()

rheckly avatar Feb 20 '25 20:02 rheckly