Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1099219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:42:04+00:00 2026-05-17T00:42:04+00:00

I have the following helper method that returns the value from a field. public

  • 0

I have the following helper method that returns the value from a field.

public static string GetValueFrom(SPListItem item, string fieldName)
        {
            string value = string.Empty;
            if (item.Fields.ContainsField(fieldName))
            {
                SPField field = item.Fields.GetField(fieldName);

                if (item[field.InternalName] != null)
                {
                    value = item[field.InternalName].ToString();
                }
            }
            return value;
        }

However for one Field (normal Choice Field) I am getting a ArgumentExecption on this line

if (item[field.InternalName] != null)

I am using

SPListItem item = list.GetItemById(itemId);

To get the item.

I cant find why I am getting the exception when I am checking to see if the field exists?
Any ideas as to why I am getting this Exception for only one field.


Update.

When debugging

The call to GetField() returns the correct field object.
Field.InternalName contains the correct Internal name of the field
If I try and access the value using item[“internal name of the field”] it still throws and exception for only this one field.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:42:05+00:00Added an answer on May 17, 2026 at 12:42 am

    Sometimes strange things happens and we do not have logical answer to those questions. Try by deleting the list and then creating the list again from scratch. DO NOT try to save it as template and DO NOT try to create the list from that template.

    One possible reason of such type of ugly messages is that the security/permissions are not allowing to manipulate that field/column.

    Another possible reason of such type of unwanted/unexpected messages is that when the field was created for the first time, its data type was different and later on it was changed to choice. Technically there should be no problem in doing so but sometimes we face odd behavior.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following C# helper class which retrieves a Json String from a
I have a static class in my solution that is basically use a helper/ultility
I have the following method that sets a few properties of IEntity. My general
I have the following methods in an enum helper class (I have simplified it
Another day , another question. My service layer has the following method public MatchViewData
We have configured iReport to generate the following graph: The real data points are
I have the following problem: I have a form in site/banen (currently local running
Is it a code smell to have to following pattern, given the following code
I'm getting the following text from a database: (supplied by client, so I can't
So I have the following: Object a = data.getA(); Object b = data.getB(); Object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.