I am updating a SharePoint list item using the ValidateUpdateListItem method of the client-side object model to prevent creation of a new item version. This basically works fine for all fields except the ones with person or group field type. Does anyone know what is the correct string representation of a user or group value to be used as FieldValue of an ListItemFormUpdateValue object? I have already tried everything that seems reasonable to me (user ID from User Info, login name, lookup-value like combinations of these data etc.) without any success.
SharePoint CSOM: How to update person or group field using ValidateUpdateListItem?
21.3k views Asked by Erwin At
2
There are 2 answers
0
TT77
On
I just ran into a problem where updating more than 12 person or group fields with item update caused it to throw an exception. Apparently this is caused due to the list view look up threshold in SP online (12 as of this date).
http://blog.vanmeeuwen-online.nl/2012/07/value-does-not-fall-within-expected.html
To work around that I used the ValidateUpdateListItem method to update the person or group ids. The trick is to assign it a json in the format of
[{"Key":"i:0#.f|membership|[email protected]"}]
formValues.Add(new ListItemFormUpdateValue() { FieldName = "AssignedTo", FieldValue = "[{'Key':'i:0#.f|membership|[email protected]'}]" });
For multiple values, it can be comma separated. Have not tried it with group but i think it should work.
Hopefully this can be useful for someone.
Related Questions in SHAREPOINT
- Can you programmatically generate a link to open a Word document and navigate to a particular location within it (preferably a comment)?
- How to automatically update a column in Sharepoint when an email item is added
- Execution Stuck at Get-PnPPage if function executed on Button Click
- How do I replace CKEditor text inside a rte-webpart?
- Difficulty Accessing SharePoint Files in Docker Container for R Script Execution
- Access denied when using Get-PnPSubWeb
- Can sharepoint calendars have images and a legend with it?
- SharePoint search field
- .NET open xps file from Sharepoint location using XpsDocument class
- Sharepoint 2016 timer service cannot start after applying windows OS patch KB5035855
- PowerShell script to output what SharePoint Online sites have privacy set to public and private
- Limit decimals from import calculated value in power BI
- Connect Sharepoint with c# via PnPCore
- Share excel file on Sharepoint
- Trouble extracting xml property from ajax response
Related Questions in UPDATES
- Unable to install .net 4.8 runtime or any updates
- Electron Updates with update.electronjs.org
- Table Update from a form using VBA
- not recognizing updates to data on 2nd edit in ObjectListView / Python
- allowDeferredLocationUpdates(untilTraveled:timeout:) deprecated
- Why am I getting a warning about conflicting distribution on apt update and the system becomes unresponsive after apt upgrade
- Patch executable is deleted by windows defender but the same was not deleted in earlier build patches
- Update Form with 2 different source models, with 2 foreach
- How to perform a major update on typo3
- Merge (insert /update)
- MONGODB. Error with arrayFilters: No array filter found for identifier 'elem' in path
- I have issue regarding windows updates and microsoft store updates
- Run a Python script from another background Python script
- Anaconda - Conda update error - PermissionError: [WinError 5]
- Migration to Survey Creator V2 over React
Related Questions in CSOM
- Connect Sharepoint with c# via PnPCore
- Im trying to make a web request to sharepoint with client authorization but get 401 response code unauthorized
- How to check if SharePoint URL exists?
- https://graph.microsoft.com/v1.0/me/followedSites not working anymore
- Sharepoint API/CSOM: How to change file content without changing version history?
- ClientContext API will not return items in Teams SharePoint site, works fine in SharePoint Online
- LoadAsync() inside PnP core sdk will only get 100 list items instead of getting all items as per the documentation
- Exception when trying to export from a SharePoint List to Excel
- Getting Access Denied when creating ClientContext without Credentials
- Get specific Sharepoint fields using FieldValuesAsText CSOM C#
- C# Console Connect to On-premise sharepoint PNP Core
- Getting size of a Sharepoint Subsite using CSOM
- Clientcontext (Sharepoint on-prem) authentication issue with error 401 - Unauthorized
- How to copy folder permission from source to target
- What is RoleAssignment, RoleDefinition, RoleBinding in Sharepoint On-premise? How to remove a user from the permission list at site level?
Related Questions in SPLISTITEM
- How to send recurrence emails without using Power Automate?
- How to fetch more than 5000 item from SharePoint Online list using @pnp/pnpjs library?
- what List item data can be gotton from SharePoint getItems() method?
- How to update SharePoint List Item with no ID column
- How can I programatically move an SPListItem from a source list to a destination list (into a specific folder of the list)?
- How to change SPListItem.Level property?
- Sharepoint List retrieve large data C#
- How To Access Solution List Item from UserControl.ascx.cs SharePoint
- When adding item to List, I get error Invalid data has been used to update the list item. The field you are trying to update may be read only
- How do I update a Sharepoint ListItem with .Net?
- C# Parallel.ForEach() on SPListItemCollection causes exception (0x80010102)
- C# - Add a File as Attachment to Microsoft.SharePoint.Client.ListItem (SharePoint 2010)
- Programmatically created document set item is always a folder
- Get workflow associated list items
- How to store number with more than 15 digits in Sharepoint?
Related Questions in SPUSERFIELD
- Sharepoint SPFx spuser getting addition fields
- sharepoint 2013 user field value types?
- SharePoint CSOM: How to update person or group field using ValidateUpdateListItem?
- How to insert 'Person or Group' field in list using VS2013?
- Convert text to UserField in SharePoint2010
- Updating User field in SharePoint
- Sharepoint SPUserField
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Unfortunately ListItem.ValidateUpdateListItem method does not support the update of user field value. For example, in the following example
AssignedTofield will not be updated:Instead consider ListItem.Update Method to update user field value as demonstrated below: