Retrieve SharePoint lookup field

In this post we will discuss how to set or retrieve SharePoint lookup field value in List using SharePoint object model

Here we have a SharePoint list name as Users and Country. Users List has a lookup column name as CountryName and is mapped to the Country List.

If you will directly (like list) retrieve the lookup field value then it will come in the below format: (ID);#(VALUE). Example 10#UK

But our requirement is to retrieve only UK.
Below is the code to Get the Lookup field:

Below is the code to Set the Lookup field:

 

About The Author

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Close