{"id":271,"date":"2017-09-15T00:00:00","date_gmt":"2017-09-15T00:00:00","guid":{"rendered":"http:\/\/officedevblogs.wpengine.com\/?p=271"},"modified":"2021-11-15T10:58:43","modified_gmt":"2021-11-15T18:58:43","slug":"new-sharepoint-csom-version-released-for-office-365-september-2017","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/new-sharepoint-csom-version-released-for-office-365-september-2017\/","title":{"rendered":"New SharePoint CSOM version released for SharePoint Online &#8211; September 2017"},"content":{"rendered":"<div id=\"body-content\">\n<p>We are happy to announce the availability of new&nbsp;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<span>. Key update is the support for accessing list item version field values. See code sample for this below.&nbsp;<\/span><\/p>\n<p>You can find the latest CSOM package for SharePoint Online, including the Project Online CSOM assembly, from the <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.SharePointOnline.CSOM\">NuGet gallery<\/a> with an id of &#8216;<strong><em>Microsoft.SharePointOnline.CSOM<\/em><\/strong>&#8216;. 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&nbsp;the SDK to your machine.<\/p>\n<p>The version of the newly released CSOM package is <strong>16.1.6906.1200<\/strong>. Previous&nbsp;versions of the NuGet have&nbsp;<strong>not<\/strong> been removed so that your existing solutions will continue working without issues and you can decide when the new version is taken into use.&nbsp;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 <em>File Version attribute<\/em>, which aligns with the NuGet version.<\/p>\n<p><img decoding=\"async\" class=\"img-responsive\" alt=\"CSOM package visible in the NuGet gallery view at Visual Studio\" src=\"https:\/\/officedevblogs.wpengine.com\/wp-content\/uploads\/2018\/05\/SPCSOMNuget16169061200.png\"><\/p>\n<p><a href=\"https:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=35588\">SharePoint Online Management Shell<\/a>&nbsp;has been also updated to match with this CSOM release and we have also pushed out an update to the MSI <a href=\"https:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=42038&amp;751be11f-ede8-5a0c-058c-2ee190a24fa6=True\">version of this package<\/a>. Notice that we do recommend to use NuGet packages rather than installing these assemblies locally to GAC by using the SDK installer.<\/p>\n<p><strong><em>Notice<\/em><\/strong>&nbsp;that since this NuGet&nbsp;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&nbsp;dependency to your target environment are clarified in following blog post &#8211; <a href=\"http:\/\/officedevblogs.wpengine.com\/using-correct-csom-version-for-sharepoint-customizations\">Using correct Client-Side Object Model (CSOM) version for SharePoint customizations<\/a>.&nbsp;We have released separate NuGet packages for on-premises. See following blog post for additional details &#8211; <a href=\"https:\/\/officedevblogs.wpengine.com\/sharepoint-csom-versions-for-on-premises-released-as-nuget-packages\">SharePoint CSOM versions for on-premises released as NuGet packages<\/a>.<\/p>\n<h2>Code sample to access version information for&nbsp;list items and files<\/h2>\n<p>Here&#8217;s a simple code sample showing how to access field values&nbsp;of the previous version and also how to access previous file versions. These have been commonly requested capabilities also in <a href=\"https:\/\/sharepoint.uservoice.com\">SharePoint UserVoice<\/a>&nbsp;and we are happy to get these features delivered and following items closed.<\/p>\n<ul>\n<li><a href=\"https:\/\/sharepoint.uservoice.com\/forums\/329220-sharepoint-dev-platform\/suggestions\/15147150-provide-items-version-history-with-csom\">Provide items version history with CSOM<\/a>&nbsp;&#8211; With this latest CSOM release, you can also access the field values of previous versions.<\/li>\n<li><a href=\"https:\/\/sharepoint.uservoice.com\/forums\/329220-sharepoint-dev-platform\/suggestions\/15147153-add-ability-to-download-old-version-of-a-file-via\">Add ability to download an&nbsp;old version of a file via API\/CSOM<\/a>&nbsp;&#8211; This actually has been possible for a while already, but below code also demonstrates how it can be done in practice.\n<\/li>\n<\/ul>\n<pre><br> \/\/ Get versions of specific document from library - item and file<br> List list = ctx.Web.Lists.GetByTitle(\"DocumentLibraryTitle\");<br> ListItem item = list.GetItemById(1);<br> ListItemVersionCollection versions = item.Versions;<br> Microsoft.SharePoint.Client.File file = item.File;<br> FileVersionCollection fileVersions = file.Versions;<br> ctx.Load(list); ctx.Load(item); ctx.Load(versions);<br> ctx.Load(file); ctx.Load(fileVersions);<br> ctx.ExecuteQuery();<br><br> \/\/ Loop list item versions and access data of specific fields<br> foreach (var version in versions)<br> {<br>   string versionValue = string.Empty;<br>   if (version.FieldValues[\"FieldName\"] != null)<br>   {<br>     versionValue = version.FieldValues[\"FieldName\"].ToString();<br>   }<br> <br>   \/\/ Do something with the value<br>   Console.WriteLine(version.VersionLabel + \" - \" + versionValue);<br> }<br><br> \/\/ Download all versions of specific file as individual docs<br> int index = 0;<br> foreach (var version in fileVersions)<br> {<br>   var str = version.OpenBinaryStream();<br>   ctx.ExecuteQuery();<br>   \/\/ Notice that we assume in this case that it's docx file<br>   string filename = string.Format(\"d:\\downloaded\\doc-{0}.docx\", index);<br>   using (var fs = new FileStream(filename, FileMode.OpenOrCreate))<br>   {<br>     str.Value.CopyTo(fs);<br>   }<br>   index++;<br> }<\/pre>\n<p><h2>New properties and methods cross assemblies<\/h2>\n<p>Here&#8217;s a raw list of all the changes in the classes,&nbsp;properties and methods within this package.&nbsp;<\/p>\n<h2>Microsoft.SharePoint.Client<\/h2>\n<p>Following properties, classes and methods have been <strong>added.<\/strong><\/p>\n<ul>\n<li>public <strong>method<\/strong> Microsoft.SharePoint.Client.List.GetBloomFilter<\/li>\n<li>public <strong>method<\/strong> Microsoft.SharePoint.Client.List.GetBloomFilterWithCustomFields<\/li>\n<li>public <strong>class<\/strong> Microsoft.SharePoint.Client.ListBloomFilter\n<\/li>\n<li>public <strong>method<\/strong> Microsoft.SharePoint.Client.ListItem.MediaServiceUpdate<\/li>\n<li>public <strong>method<\/strong> Microsoft.SharePoint.Client.ListItem.SetComplianceTagWithExplicitMetasUpdate\n<\/li>\n<li>public <strong>property<\/strong> Microsoft.SharePoint.Client.ListItemVersion.FieldValues<\/li>\n<li>public <strong>property<\/strong> Microsoft.SharePoint.Client.ListItemVersion.Item\n<\/li>\n<li>public <strong>class<\/strong> Microsoft.SharePoint.Client.MediaServiceUpdateParameters<\/li>\n<li>public <strong>property<\/strong> Microsoft.SharePoint.Client.ObjectSharingSettings.DefaultShareLinkPermission\n<\/li>\n<li>public <strong>method<\/strong> Microsoft.SharePoint.Client.Web.GetOnePageContextAsStream<\/li>\n<li>public <strong>method<\/strong> Microsoft.SharePoint.Client.Web.GetStorageEntity<\/li>\n<li>public <strong>method<\/strong> Microsoft.SharePoint.Client.Web.RemoveStorageEntity<\/li>\n<li>public <strong>method<\/strong> Microsoft.SharePoint.Client.Web.SetStorageEntity\n<\/li>\n<li>public <strong>class<\/strong> Microsoft.SharePoint.Client.Utilities.JsonTheme<\/li>\n<li>public <strong>class<\/strong> Microsoft.SharePoint.Client.Utilities.ThemingOptions<\/li>\n<li>public <strong>class<\/strong> Microsoft.SharePoint.ClientSideComponent.StorageEntity\n<\/li>\n<\/ul>\n<h2>Microsoft.Online.SharePoint.Client.Tenant<\/h2>\n<p>Following properties, classes and methods have been <strong>added.<\/strong><\/p>\n<ul>\n<li>public <strong>property<\/strong> Microsoft.Online.SharePoint.TenantAdministration.SiteProperties.AllowDownloadingNonWebViewableFiles<\/li>\n<li>public <strong>property<\/strong> Microsoft.Online.SharePoint.TenantAdministration.SiteProperties.ConditionalAccessPolicy\n<\/li>\n<li>public <strong>method<\/strong> Microsoft.Online.SharePoint.TenantAdministration.Tenant.AddTenantTheme<\/li>\n<li>public <strong>property<\/strong> Microsoft.Online.SharePoint.TenantAdministration.Tenant.AllowDownloadingNonWebViewableFiles<\/li>\n<li>public <strong>property<\/strong> Microsoft.Online.SharePoint.TenantAdministration.Tenant.AllowLimitedAccessOnUnmanagedDevices<\/li>\n<li>public <strong>property<\/strong> Microsoft.Online.SharePoint.TenantAdministration.Tenant.BlockAccessOnUnmanagedDevices<\/li>\n<li>public <strong>property<\/strong> Microsoft.Online.SharePoint.TenantAdministration.Tenant.ConditionalAccessPolicy<\/li>\n<li>public <strong>property<\/strong> Microsoft.Online.SharePoint.TenantAdministration.Tenant.DefaultLinkPermission<\/li>\n<li>public <strong>method<\/strong> Microsoft.Online.SharePoint.TenantAdministration.Tenant.DeleteTenantTheme<\/li>\n<li>public <strong>property<\/strong> Microsoft.Online.SharePoint.TenantAdministration.Tenant.FilePickerExternalImageSearchEnabled\n<\/li>\n<li>public <strong>method<\/strong> Microsoft.Online.SharePoint.TenantAdministration.Tenant.GetAllTenantThemes<\/li>\n<li>public <strong>method<\/strong> Microsoft.Online.SharePoint.TenantAdministration.Tenant.GetTenantTheme<\/li>\n<li>public <strong>property<\/strong> Microsoft.Online.SharePoint.TenantAdministration.Tenant.HideDefaultThemes<\/li>\n<li>public <strong>method<\/strong> Microsoft.Online.SharePoint.TenantAdministration.Tenant.UpdateTenantTheme\n<\/li>\n<li>public <strong>method<\/strong> Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.AddTenantTheme<\/li>\n<li>public <strong>property<\/strong> Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.AllowDownloadingNonWebViewableFiles<\/li>\n<li>public <strong>property<\/strong> Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.AllowLimitedAccessOnUnmanagedDevices<\/li>\n<li>public <strong>property<\/strong> Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.BlockAccessOnUnmanagedDevices<\/li>\n<li>public <strong>property<\/strong> Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.ConditionalAccessPolicy<\/li>\n<li>public <strong>property<\/strong> Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.DefaultLinkPermission<\/li>\n<li>public <strong>method<\/strong> Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.DeleteTenantTheme<\/li>\n<li>public <strong>property<\/strong> Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.FilePickerExternalImageSearchEnabled\n<\/li>\n<li>public <strong>method<\/strong> Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.GetAllTenantThemes<\/li>\n<li>public <strong>method<\/strong> Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.GetHideDefaultThemes<\/li>\n<li>public <strong>method<\/strong> Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.GetTenantTheme<\/li>\n<li>public <strong>method<\/strong> Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.SetHideDefaultThemes<\/li>\n<li>public <strong>method<\/strong> Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.UpdateTenantTheme\n<\/li>\n<li>public <strong>enum<\/strong> Microsoft.Online.SharePoint.TenantManagement.SharingPermissionType<\/li>\n<li>public <strong>enum<\/strong> Microsoft.Online.SharePoint.TenantManagement.SPOConditionalAccessPolicyType<\/li>\n<li>public <strong>class<\/strong> Microsoft.Online.SharePoint.TenantManagement.ThemeProperties\n<\/li>\n<\/ul>\n<p><span style=\"font-size: large\"><em>&ldquo;Sharing is caring&rdquo;<\/em><\/span><\/p>\n<hr>\n<p><i><a href=\"https:\/\/twitter.com\/vesajuvonen\">Vesa Juvonen<\/a>, Senior Program Manager, OneDrive-SharePoint Engineering, Microsoft &#8211; 15th&nbsp;of September 2017<\/i><\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>We are happy to announce the availability of new&nbsp;SharePoint Client-Side Object Model (CSOM) version targeted for the Office 365 or more specifically for SharePoint and Project Online. This<\/p>\n","protected":false},"author":69217,"featured_media":272,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[],"class_list":["post-271","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sharepoint-framework"],"acf":[],"blog_post_summary":"<p>We are happy to announce the availability of new&nbsp;SharePoint Client-Side Object Model (CSOM) version targeted for the Office 365 or more specifically for SharePoint and Project Online. This<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/271","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/users\/69217"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/comments?post=271"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/271\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media\/272"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media?parent=271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/categories?post=271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/tags?post=271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}