execute_batch() with FieldMultiLookupValue() Error
I'm trying to import a large amount of data into several SharePoint lists using list_name.add_item({}). One of the columns in one of the lists is a MultiLookup. Currently I can add an item using FieldMultiLookupValue() fine when using execute_query(), but due to how long its taking, I've been trying to use execute_batch() instead, however I keep getting the error:
('-1, Microsoft.SharePoint.Client.InvalidClientQueryException', "An open collection property 'CountryofCitizenshipId' was found. In OData, open collection properties are not supported."
Is there a different way to add_items with FieldMultiLookupValue() and still use execute_batch() or is this a bug?
I'm having the same issue. From examination of the requests being sent, I believe it might be linked to this issue: https://github.com/SharePoint/sp-dev-docs/issues/4831#issuecomment-547339578
Using execute_query(), the request assigns the correct list item type in
{
"__metadata":
{
"type": "SP.Data.MyListListItem"
}
}
When doing the same thing with execute_batch(), the request has this metadata:
{
"__metadata":
{
"type": "SP.ListItem"
}
}
Here's a workaround I found which seems to work fine:
# Fetch the ListItemEntityTypeFullName from SharePoint
my_list = client.lists.get_by_id("xxx").select(["ListItemEntityTypeFullName"]).get().execute_query()
item = my_list.add_item(...)
# Override the entity type name of the list item manually
item._entity_type_name = my_list.list_item_entity_type_full_name
my_list.execute_batch() # Works