Not able to Update LookUp property
See original GitHub issueCategory
- Bug
Describe the bug
Using CSOM, It is possible to update the lookup property with a string value, which does not particularly require its lookupvalue property type.
For example item[“MetaInfo”] = “some XML values” It is possible to read back the same string value during the read. I need a way to update value in a same way on PnP.
Steps to reproduce
I tried the same on PnP, However, am not able to set the property. It neither throws an exception.
var parentList = await context.Web.Lists.GetByTitleAsync("AddTest", l => l.EnableModeration, l => l.TemplateType, l => l.EnableVersioning, l => l.Title, l => l.Fields, l => l.ContentTypes);
var parentWeb = await context.Web.GetAsync(s => s.Language, s=>s.Url);
var parentFields = parentList.Fields.ToList();
List<Dictionary<string, object>> propertiesToUpdate = new List<Dictionary<string, object>>();
var prop = new Dictionary<string, object>();
prop.Add("Title", "My title 1");
prop.Add("MetaInfo", "abc");
propertiesToUpdate.Add(prop);
var prop2 = new Dictionary<string, object>();
prop2.Add("Title", "My title 2");
propertiesToUpdate.Add(prop2);
var uploadedListItems = new List<IListItem>();
foreach (var propItem in propertiesToUpdate)
{
try
{
var item = await parentList.Items.AddBatchAsync(propItem);
uploadedListItems.Add(item);
}
catch(Exception ex)
{
}
}
var batchResponses = await context.ExecuteAsync(false);
await uploadedListItems.First().LoadAsync(d => d.All);
foreach (var batchResponse in batchResponses)
{
}
Expected behavior
It should have been updated with no issue
Environment details (development & target environment)
- SDK version: [1.1.0 ]
- OS: [Windows 10]
- SDK used in: [ Console App ]
- Framework: [.NET Framework v4.7.2]
- Tooling: [Visual Studio 2019]
Additional context
Thanks for your contribution! Sharing is caring.
Issue Analytics
- State:
- Created 2 years ago
- Comments:23 (13 by maintainers)
Top Results From Across the Web
Solved: LookUp Field not updating i n sharepoint list
Since you customize the lookup field's data card, you need to change its Update property. Try to set the data card's Update property:...
Read more >The Trick to Updating Custom Lookups using the Dynamics ...
In Dynamics 365 Power Apps, when updating a custom lookup field using the Web API, you may run into an “undeclared property” error....
Read more >Trouble updating a field of type lookup with Microsoft CRM ...
I currently have some code that uses http patch to send Microsoft CRM data via the 2016 web api. When my payload includes...
Read more >Trigger on custom object to update lookup field from other ...
i have a custom object called Booking__c that has a lookup field called Commission_Agent__c. Booking__c is related via lookup to another custom ...
Read more >2013 - Update Lookup Site Column
It's not possible to Edit lookup columns to deleted lists. You can use powershell to do so. Check the posts here and here....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@gopaldahal : I don’t see any other options for this edge case (there’s very few people updating the metainfo field), so are you good with closing this issue?
Sure. I will come to this soon.