Get a SharePoint list item using custom field #1436
-
I have a SharePoint list titled as "System Setting and Configuration", and it has a field named "SettingReferecne" & "SettingValue", now i am trying to get the setting value using the setting reference, as follow:- `var settingList = context.Web.Lists.GetByTitle("System Setting and Configuration"); var WOHWItem = settingList.Items.AsRequested().FirstOrDefault(p => p["SettingReference"].ToString() == "14"); var WOHWs = WOHWItem["SettingValue"].ToString().Split(';'); but the var WOHWItem will always be null.. any advice? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@mvcsharepointdev : did you check the custom field was loaded when you inspect the items collection that was returned. Also do know that you'll only get the first 100 items in this way. Maybe better to use a CAML query to directly grab the item you need? See https://pnp.github.io/pnpcore/using-the-sdk/listitems-intro.html#reading-list-items |
Beta Was this translation helpful? Give feedback.
@mvcsharepointdev : did you check the custom field was loaded when you inspect the items collection that was returned. Also do know that you'll only get the first 100 items in this way. Maybe better to use a CAML query to directly grab the item you need? See https://pnp.github.io/pnpcore/using-the-sdk/listitems-intro.html#reading-list-items