-
-
Notifications
You must be signed in to change notification settings - Fork 352
Need to add item to SharePoint List with lookup column #459
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
Comments
Hey , were u able to read files from item list? |
Yes, I able to read the data from sharepoint list |
Hey, the following examples demonstrates how to set lookup field value: list_tasks = ctx.web.lists.get_by_title("Tasks")
items = list_tasks.items.get().top(1).execute_query()
if len(items) == 0:
sys.exit("No items was found")
field_value = FieldLookupValue(lookup_id)
items[0].set_property(lookup_field_name, field_value).update().execute_query() and multi lookup field value: field_value = FieldMultiLookupValue()
field_value.add(FieldLookupValue(lookup_id))
items[0].set_property(multi_lookup_field_name, field_value).update().execute_query() |
I think this is not working in the most recent version:
And getting back |
I have the same issue @lealcastillo1996 :) were you able to fix it? |
Hey @bizzinho — unfortunately not. This is my most recent post where I reported the bug: I’ve tried multiple libraries and notations for posting the JSON directly, spending hours and hours on it, but nothing worked. It seems like the Microsoft backend notation has changed, and there’s not much documentation available about it. If @vgrem and the team manage to solve this one, they honestly deserve a monument! |
Thanks @lealcastillo1996 , not sure this will help you, but in my case the problem seems to have been something with the list itself i found out today. Even manually I wasn't able to add more than one lookup element to fields. The items would simply disappear! The behavior stopped when I toggled the "multiple values" switch in the sharepoint UI off and on again. Suddenly the elements would stay after adding and the above code worked again.... |
@bizzinho Thanks so much for the tip!. I did the same "multiple values" de-activation and activation back via code and it seems to work now, crazy hahaha. So I will call it problem solved. |
Hi,
I would like to add a item to a list in which few of the columns are lookup columns. do you have any code sinppet to perfrom it?
The text was updated successfully, but these errors were encountered: