How to retrieve values in list item fields #1212
Replies: 3 comments 2 replies
-
See https://pnp.github.io/pnpcore/using-the-sdk/listitems-intro.html#reading-list-items |
Beta Was this translation helpful? Give feedback.
-
Thank you so much for your answer. I am testing the below example from the documentation: When I inspect the fields in listItem, I only see 25 fields: but below is my entire list of fields for that library, How I can add ALL fields to the listitem object? Thanks
|
Beta Was this translation helpful? Give feedback.
-
Understood, thanks for the clarification. One more issue/question: I am uploading files to SP, updating some metadata fields, then sending the fields values to the source system in the response. After I upload the document I am reloading the fields a follow: await fileAdded.LoadAsync(p => p.ListItemAllFields); Then I update several custom fields as follow: fileAdded.ListItemAllFields["System"] = “some value”; One of the field I need to update is the Author. I have read the documentation on how to update the system properties and I found a couple of discussions where they indicate what kind of permission I need to update the system properties, so this is clear to me. However, In that collection of fields, I see the field: AuthorId. I don’t see field Author. But in the example from the documentation, I should be able to see Author in the ListItemAllFields. Would you please clarify this for me, what I am missing here? Thanks |
Beta Was this translation helpful? Give feedback.
-
Hi,
I need to retrieve the value stored in the fields of specific item but based on the field type Datetime and text.
I am having difficulties understanding how to read the values.
I have read the documentation below
https://pnp.github.io/pnpcore/using-the-sdk/listitems-fields.html
but this explains how to assign the value based on the field type and I cannot figure it how to retrieve the value instead.
Please can you provide me an example on how to read the values for fields datetime and text? I will really appreciated.
This is an example of part of the code I am using:
var rootList = (await context.Web.Lists.GetByServerRelativeUrlAsync($"{context.Uri.PathAndQuery}{relativeURL}", p => p.RootFolder, p => p.Fields));
foreach (var field in rootList.Fields.AsRequested())
{
//Read value here
}
Thanks
Beta Was this translation helpful? Give feedback.
All reactions