Skip to content

Update URL field in a list - with execute_batch() #943

Open
@rheckly

Description

@rheckly

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions