SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,624 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
How to get wiki content from page versions( like 1.0, 2.0) Wiki Page Library in c# using CSOM.
there is no method to get content from versions.
We could get the page content in the version.FieldValues
property.
using (var clientContext = new ClientContext("https://contoso.sharepoint.com/sites/dev"))
{
// SharePoint Online Credentials
clientContext.Credentials = new SharePointOnlineCredentials(userName, password);
ListItem item = clientContext.Web.Lists.GetByTitle("Site Pages").GetItemById(44);
clientContext.Load(item,li=>li.Versions);
clientContext.ExecuteQueryRetry();
foreach (ListItemVersion version in item.Versions)
{
Console.WriteLine(version.VersionLabel);
Console.WriteLine(version.FieldValues["WikiField"]);
}
Console.ReadLine();
}
Test result:
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Thanks @Amos Wu-MSFT