New SharePoint CSOM version released for SharePoint Online - September 2017

We are happy to announce the availability of new SharePoint Client-Side Object Model (CSOM) version targeted for the Office 365 or more specifically for SharePoint and Project Online. This release again contains updates on the existing SharePoint and Project CSOM assemblies and some maintenance changes. Key update is the support for accessing list item version field values. See code sample for this below. 

You can find the latest CSOM package for SharePoint Online, including the Project Online CSOM assembly, from the NuGet gallery with an id of 'Microsoft.SharePointOnline.CSOM'. We are also working on updating the redistributable package at some point, but you can already right now start using some of these new capabilities in your solutions. We do recommend you to use the NuGet Package to gain access to the latest version, rather than downloading the SDK to your machine.

The version of the newly released CSOM package is 16.1.6906.1200. Previous versions of the NuGet have not been removed so that your existing solutions will continue working without issues and you can decide when the new version is taken into use. Notice that even though the NuGet version is increased to 16.1.6906.1200, actual assembly version of the released assemblies is 16.1.0.0. You can also check the version of the assemblies from the File Version attribute, which aligns with the NuGet version.

CSOM package visible in the NuGet gallery view at Visual Studio

SharePoint Online Management Shell has been also updated to match with this CSOM release and we have also pushed out an update to the MSI version of this package. Notice that we do recommend to use NuGet packages rather than installing these assemblies locally to GAC by using the SDK installer.

Notice that since this NuGet package is targeted to SharePoint Online, you cannot use it directly in on-premises environments (SharePoint 2013 or 2016). This is because of the server side dependencies of the APIs. CSOM versioning model and dependency to your target environment are clarified in following blog post - Using correct Client-Side Object Model (CSOM) version for SharePoint customizations. We have released separate NuGet packages for on-premises. See following blog post for additional details - SharePoint CSOM versions for on-premises released as NuGet packages.

Code sample to access version information for list items and files

Here's a simple code sample showing how to access field values of the previous version and also how to access previous file versions. These have been commonly requested capabilities also in SharePoint UserVoice and we are happy to get these features delivered and following items closed.


// Get versions of specific document from library - item and file
List list = ctx.Web.Lists.GetByTitle("DocumentLibraryTitle");
ListItem item = list.GetItemById(1);
ListItemVersionCollection versions = item.Versions;
Microsoft.SharePoint.Client.File file = item.File;
FileVersionCollection fileVersions = file.Versions;
ctx.Load(list); ctx.Load(item); ctx.Load(versions);
ctx.Load(file); ctx.Load(fileVersions);
ctx.ExecuteQuery();

// Loop list item versions and access data of specific fields
foreach (var version in versions)
{
string versionValue = string.Empty;
if (version.FieldValues["FieldName"] != null)
{
versionValue = version.FieldValues["FieldName"].ToString();
}

// Do something with the value
Console.WriteLine(version.VersionLabel + " - " + versionValue);
}

// Download all versions of specific file as individual docs
int index = 0;
foreach (var version in fileVersions)
{
var str = version.OpenBinaryStream();
ctx.ExecuteQuery();
// Notice that we assume in this case that it's docx file
string filename = string.Format("d:\\downloaded\\doc-{0}.docx", index);
using (var fs = new FileStream(filename, FileMode.OpenOrCreate))
{
str.Value.CopyTo(fs);
}
index++;
}

New properties and methods cross assemblies

Here's a raw list of all the changes in the classes, properties and methods within this package. 

Microsoft.SharePoint.Client

Following properties, classes and methods have been added.

  • public method Microsoft.SharePoint.Client.List.GetBloomFilter
  • public method Microsoft.SharePoint.Client.List.GetBloomFilterWithCustomFields
  • public class Microsoft.SharePoint.Client.ListBloomFilter

  • public method Microsoft.SharePoint.Client.ListItem.MediaServiceUpdate
  • public method Microsoft.SharePoint.Client.ListItem.SetComplianceTagWithExplicitMetasUpdate

  • public property Microsoft.SharePoint.Client.ListItemVersion.FieldValues
  • public property Microsoft.SharePoint.Client.ListItemVersion.Item

  • public class Microsoft.SharePoint.Client.MediaServiceUpdateParameters
  • public property Microsoft.SharePoint.Client.ObjectSharingSettings.DefaultShareLinkPermission

  • public method Microsoft.SharePoint.Client.Web.GetOnePageContextAsStream
  • public method Microsoft.SharePoint.Client.Web.GetStorageEntity
  • public method Microsoft.SharePoint.Client.Web.RemoveStorageEntity
  • public method Microsoft.SharePoint.Client.Web.SetStorageEntity

  • public class Microsoft.SharePoint.Client.Utilities.JsonTheme
  • public class Microsoft.SharePoint.Client.Utilities.ThemingOptions
  • public class Microsoft.SharePoint.ClientSideComponent.StorageEntity

Microsoft.Online.SharePoint.Client.Tenant

Following properties, classes and methods have been added.

  • public property Microsoft.Online.SharePoint.TenantAdministration.SiteProperties.AllowDownloadingNonWebViewableFiles
  • public property Microsoft.Online.SharePoint.TenantAdministration.SiteProperties.ConditionalAccessPolicy

  • public method Microsoft.Online.SharePoint.TenantAdministration.Tenant.AddTenantTheme
  • public property Microsoft.Online.SharePoint.TenantAdministration.Tenant.AllowDownloadingNonWebViewableFiles
  • public property Microsoft.Online.SharePoint.TenantAdministration.Tenant.AllowLimitedAccessOnUnmanagedDevices
  • public property Microsoft.Online.SharePoint.TenantAdministration.Tenant.BlockAccessOnUnmanagedDevices
  • public property Microsoft.Online.SharePoint.TenantAdministration.Tenant.ConditionalAccessPolicy
  • public property Microsoft.Online.SharePoint.TenantAdministration.Tenant.DefaultLinkPermission
  • public method Microsoft.Online.SharePoint.TenantAdministration.Tenant.DeleteTenantTheme
  • public property Microsoft.Online.SharePoint.TenantAdministration.Tenant.FilePickerExternalImageSearchEnabled

  • public method Microsoft.Online.SharePoint.TenantAdministration.Tenant.GetAllTenantThemes
  • public method Microsoft.Online.SharePoint.TenantAdministration.Tenant.GetTenantTheme
  • public property Microsoft.Online.SharePoint.TenantAdministration.Tenant.HideDefaultThemes
  • public method Microsoft.Online.SharePoint.TenantAdministration.Tenant.UpdateTenantTheme

  • public method Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.AddTenantTheme
  • public property Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.AllowDownloadingNonWebViewableFiles
  • public property Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.AllowLimitedAccessOnUnmanagedDevices
  • public property Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.BlockAccessOnUnmanagedDevices
  • public property Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.ConditionalAccessPolicy
  • public property Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.DefaultLinkPermission
  • public method Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.DeleteTenantTheme
  • public property Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.FilePickerExternalImageSearchEnabled

  • public method Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.GetAllTenantThemes
  • public method Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.GetHideDefaultThemes
  • public method Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.GetTenantTheme
  • public method Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.SetHideDefaultThemes
  • public method Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.UpdateTenantTheme

  • public enum Microsoft.Online.SharePoint.TenantManagement.SharingPermissionType
  • public enum Microsoft.Online.SharePoint.TenantManagement.SPOConditionalAccessPolicyType
  • public class Microsoft.Online.SharePoint.TenantManagement.ThemeProperties

“Sharing is caring”


Vesa Juvonen, Senior Program Manager, OneDrive-SharePoint Engineering, Microsoft - 15th of September 2017