Я пытаюсь прочитать все версии списка на сайте и сохранить их. Я хотел бы сделать это для всей строки, а не столбец за столбцом (или элемент за элементом). Я видел это здесь https://sharepoint.stackexchange.com/questions/137360/how-to-get-all-major-versions-of-list-or-library-item-using-c, но не могу обойти это, так как ни один из oList, items и listItem не имеет атрибута "Version". Я включил управление версиями для своего списка в SharePoint. Ниже мой код в C#.
using (ClientContext clientContext = new ClientContext("https://domain.sharepoint.com/sites/mysite"))
{
SecureString passWord = new SecureString();
foreach (char c in "mypass".ToCharArray()) passWord.AppendChar(c);
clientContext.Credentials = new SharePointOnlineCredentials("email@domain", passWord);
Web web = clientContext.Web;
clientContext.Load(web);
clientContext.ExecuteQuery();
CamlQuery query = new CamlQuery();
query.ViewXml = @"";
SP.List oList = clientContext.Web.Lists.GetByTitle("listname");
clientContext.Load(oList);
clientContext.ExecuteQuery();
SP.ListItemCollection items = oList.GetItems(query);
clientContext.Load(items);
clientContext.ExecuteQuery();
foreach (ListItem listItem in items)
{
foreach (KeyValuePair<string, object> dictitem in listItem.FieldValues)
{
//Read this key, value and save them in a datatable
}
}
}
купить с использованием v16 SharePoint SDK и предметов. Версии, я получаю следующую ошибку:
Error CS1061 'ListItemCollection' does not contain a definition
for 'Versions' and no accessible extension method 'Versions' accepting a
first argument of type 'ListItemCollection' could be found (are you missing
a using directive or an assembly reference?)