Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
rheckly opened this issue Feb 20, 2025 · 0 comments
Open

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

rheckly opened this issue Feb 20, 2025 · 0 comments
Labels

Comments

@rheckly
Copy link

rheckly commented Feb 20, 2025

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()
@vgrem vgrem added the bug label Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants