0

I have a Sharepoint url column and retrieving the value programmatically C#. But I get the error always

Value does not fall in expected range.

I have the field URL which is a hyperlink type, I have cross checked .

SPFieldUrlValue value = new SPFieldUrlValue(item[“URL”].ToString());
string URL = value.Url;
3
  • Is the field "URL"of type Hyperlink? Commented Nov 7, 2014 at 6:33
  • Yep it is hyperlink Commented Nov 7, 2014 at 13:43
  • Check the CAML query and make sure you have requested for that field? Commented Nov 7, 2014 at 14:28

1 Answer 1

1

There can be multiple reasons for this behavior

  1. Make sure URL is the correct internal name of the field. To find internal name you can use List Setting page
  2. If the list has more than 5000 items then list threshold can cause this problem. To fix this change the list view threshold in Central admin
  3. Make sure the SP Query ViewFields is requesting for this field.
3
  • Internal name is correct and i also removed the ViewFields property . The list has millions of records , but i can get all other field except this url field . Commented Nov 7, 2014 at 14:54
  • Can you post the query you are executing? Commented Nov 7, 2014 at 14:56
  • When i removed ViewField and Viewfield=true , it worked . If i include view field in query ,it doesnt work . Commented Nov 7, 2014 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.