Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

get values of field of a list

$
0
0

i want to retrive the value of the field 'employeeName' from my list'employeeDetails'. i have the code below.i got error as-

uncaught syntax error : unexpected identifier.how to fix this?if you have any other method then plz suggest.

<!DOCTYPE html>
<head>
<script type="text/javascript" src="/sites/practice/Shared%20Documents/jquery-3.1.0.min.js"></script>
 <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.02/jquery.SPServices-2014.02.min.js"></script>
<script>
string server = "https://mogembo1.sharepoint.com/sites/Practice";
var ctx = new ClientContext(server);
var web = ctx.Web;
var list = web.Lists.GetByTitle("employeeDetails");
var listItemCollection = list.GetItems(CamlQuery.CreateAllItemsQuery());

// always use QueryTrimming to minimize size of 
// data that has to be transfered

ctx.Load(listItemCollection,
           eachItem => eachItem.Include(
            item => item,
            item => item["employeeName"]));
// ExecuteQuery will pull all data from SharePoint
// which has been staged to Load()
ctx.ExecuteQuery();

foreach(ListItem listItem in listItemCollection)
{
   Console.WriteLine(listItem["employeeName"]);
}
}
</script>
</head>
</html>


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>