Doniyor Niazov

Doniyor Niazov

  • NA
  • 72
  • 774

How to get ListItem of the page in c#

Aug 25 2016 7:26 AM
So I found a code to edit a sharepoint page programmatically.<br /><br /> public static bool EditPage(SPClient.ListItem item, string pageTitle, string pageContent, string publishComment)<br /> {<br /> var pageEdited = false;<br /> try<br /> {<br /> item["Title"] = pageTitle;<br /> item["PublishingPageContent"] = pageContent;<br /> item.Update();<br /> SharePointTools.ClientContext.ExecuteQuery();<br /> item.File.Publish(publishComment); <br /> SharePointTools.ClientContext.ExecuteQuery();<br /> pageEdited = true;<br /> }<br /> catch (Exception ex)<br /> {<br /> pageEdited = false;<br /> }<br /> return pageEdited;<br /><div> }</div><div>&nbsp;</div>So I got all my pages and how I can get an `SPClient.ListItem item` of every page.

Answers (1)