kamagra how much to take

Add An Item To A Folder To A List With CSOM

Its really similar to how you would do it with traditional server side OM means. This is a static helper method that will generate a new folder in some list. Essentially we just have to spin a ListItemCreationInformation object specified with empty properties and just set the FolderUrl.

  1. public static ListItem AddItemInFolder(string siteUrl, string listName, string folderPath, ClientContext clientContext)
  2. {
  3. List list = clientContext.Web.Lists.GetByTitle(listName);
  4. ListItemCreationInformation listItemCreationInformation = null;
  5. if (!String.IsNullOrEmpty(folderPath))
  6. {
  7. listItemCreationInformation = new ListItemCreationInformation();
  8. listItemCreationInformation.FolderUrl = String.Format("{0}/{1}", siteUrl, folderPath);
  9. }
  10. ListItem listItem = list.AddItem(listItemCreationInformation);
  11. listItem.Update();
  12. clientContext.ExecuteQuery();
  13. return listItem;
  14. }
Share

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> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>