Guest User

Untitled

a guest
Jan 18th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. //Get connection
  2. ClientContext context = new ClientContext("URL");
  3. Web site = context.Web;
  4. context.Load(site);
  5. context.ExecuteQuery();
  6.  
  7. //Get list collection
  8. ListCollection lists = context.Web.Lists;
  9. context.Load(lists);
  10. context.ExecuteQuery();
  11.  
  12. //Get specific list
  13. List menu = lists.GetByTitle("menu");
  14. CamlQuery camlQuery = new CamlQuery();
  15. camlQuery.ViewXML = "<View/>";
  16. ListItemCollection dishes = menu.GetItems(camlQuery);
  17. context.Load(menu);
  18. context.Load(dishes);
  19. context.ExecuteQuery();
  20.  
  21. //Iterate through all dishes
  22.  
  23. foreach(ListItem dish in dishes)
  24. {
  25. Console.WriteLine("Dish: {0}:", dish.FieldValues["Name"]);
  26. Console.WriteLine("Price: {0}:", dish.FieldValues["Price"]);
  27. //Here I get my problem
  28. Console.WriteLine("Ingredients: {0}:", dish.FieldValues["Ingredients"]);
  29. }
  30.  
  31. string myString = item.FieldMultiLineText[Field_Name]
  32.  
  33. dish.FieldValuesAsText["Ingredients"];
  34.  
  35. context.Load(dishes,items=>items.Include(item=>item.FieldValuesAsText));
Add Comment
Please, Sign In to add comment