I created a custom list which contains different field values e.g.
- Text
- Choice
- Note
- Currency
- Peoplepicker
Using the following code I print the field values to console:
List mealList = spLists.GetByTitle("Meals");
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXML = "<View/>";
ListItemCollection listItems = mealList.GetItems(camlQuery);
clientcontext.Load(mealList);
clientContext.Load(listItems);
clientContext.ExecuteQuery();
foreach(ListItem item in listItems)
{
Console.WriteLine("Meal: {0}",item.FieldValues["Meal"]); //Textfield
Console.WriteLine("Country: {0}",item.FieldValues["Country"]); //Textfield
Console.WriteLine("Ingredients: {0}",item.FieldValues["Ingredients"]); //Notefield
Console.WriteLine("Price: {0}",item.FieldValues["Price"]); //Currency
Console.WriteLine("User: {0}",item.FieldValues["User"]); //Peoplepicker
}
The output looks fine except for two of the fields.
The Ingredients output somehow seems to print html-tags along with the normal output. So it looks like:
Ingredients: <div class="ExternalClass9B27C4....."><p>water, salt, potatos...</p></div>
Also at some point there are question marks where I never put them in.
The second troublemaker field is the "User". I expected it to print the user's name as a string. instead it writes:
Microsoft.Sharepoint.Client.FieldUserValue
How could i solve this issue?