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;
  • Is the field "URL"of type Hyperlink? – Harshini Hegde Nov 7 '14 at 6:33
  • Yep it is hyperlink – Nikhil J Nov 7 '14 at 13:43
  • Check the CAML query and make sure you have requested for that field? – Amal Hashim Nov 7 '14 at 14:28
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.
  • 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 . – Nikhil J Nov 7 '14 at 14:54
  • Can you post the query you are executing? – Amal Hashim Nov 7 '14 at 14:56
  • When i removed ViewField and Viewfield=true , it worked . If i include view field in query ,it doesnt work . – Nikhil J Nov 7 '14 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.