{"action":"created","issue":{"url":"https://api.github.com/repos/SharePoint/PnP-Sites-Core/issues/885","repository_url":"https://api.github.com/repos/SharePoint/PnP-Sites-Core","labels_url":"https://api.github.com/repos/SharePoint/PnP-Sites-Core/issues/885/labels{/name}","comments_url":"https://api.github.com/repos/SharePoint/PnP-Sites-Core/issues/885/comments","events_url":"https://api.github.com/repos/SharePoint/PnP-Sites-Core/issues/885/events","html_url":"https://github.com/SharePoint/PnP-Sites-Core/pull/885","id":194076535,"number":885,"title":"Bugfix: Do not update ListItem after every field change","user":{"login":"sebastianmattar","id":14279057,"avatar_url":"https://avatars.githubusercontent.com/u/14279057?v=3","gravatar_id":"","url":"https://api.github.com/users/sebastianmattar","html_url":"https://github.com/sebastianmattar","followers_url":"https://api.github.com/users/sebastianmattar/followers","following_url":"https://api.github.com/users/sebastianmattar/following{/other_user}","gists_url":"https://api.github.com/users/sebastianmattar/gists{/gist_id}","starred_url":"https://api.github.com/users/sebastianmattar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebastianmattar/subscriptions","organizations_url":"https://api.github.com/users/sebastianmattar/orgs","repos_url":"https://api.github.com/users/sebastianmattar/repos","events_url":"https://api.github.com/users/sebastianmattar/events{/privacy}","received_events_url":"https://api.github.com/users/sebastianmattar/received_events","type":"User","site_admin":false},"labels":[{"id":245227270,"url":"https://api.github.com/repos/SharePoint/PnP-Sites-Core/labels/cla-already-signed","name":"cla-already-signed","color":"009800","default":false}],"state":"closed","locked":false,"assignee":{"login":"jansenbe","id":7451219,"avatar_url":"https://avatars.githubusercontent.com/u/7451219?v=3","gravatar_id":"","url":"https://api.github.com/users/jansenbe","html_url":"https://github.com/jansenbe","followers_url":"https://api.github.com/users/jansenbe/followers","following_url":"https://api.github.com/users/jansenbe/following{/other_user}","gists_url":"https://api.github.com/users/jansenbe/gists{/gist_id}","starred_url":"https://api.github.com/users/jansenbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jansenbe/subscriptions","organizations_url":"https://api.github.com/users/jansenbe/orgs","repos_url":"https://api.github.com/users/jansenbe/repos","events_url":"https://api.github.com/users/jansenbe/events{/privacy}","received_events_url":"https://api.github.com/users/jansenbe/received_events","type":"User","site_admin":false},"assignees":[{"login":"jansenbe","id":7451219,"avatar_url":"https://avatars.githubusercontent.com/u/7451219?v=3","gravatar_id":"","url":"https://api.github.com/users/jansenbe","html_url":"https://github.com/jansenbe","followers_url":"https://api.github.com/users/jansenbe/followers","following_url":"https://api.github.com/users/jansenbe/following{/other_user}","gists_url":"https://api.github.com/users/jansenbe/gists{/gist_id}","starred_url":"https://api.github.com/users/jansenbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jansenbe/subscriptions","organizations_url":"https://api.github.com/users/jansenbe/orgs","repos_url":"https://api.github.com/users/jansenbe/repos","events_url":"https://api.github.com/users/jansenbe/events{/privacy}","received_events_url":"https://api.github.com/users/jansenbe/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-12-07T15:16:51Z","updated_at":"2016-12-08T10:33:21Z","closed_at":"2016-12-08T10:32:51Z","pull_request":{"url":"https://api.github.com/repos/SharePoint/PnP-Sites-Core/pulls/885","html_url":"https://github.com/SharePoint/PnP-Sites-Core/pull/885","diff_url":"https://github.com/SharePoint/PnP-Sites-Core/pull/885.diff","patch_url":"https://github.com/SharePoint/PnP-Sites-Core/pull/885.patch"},"body":"| Q               | A\r\n| --------------- | ---\r\n| Bug fix?        | yes\r\n| New feature?    | no\r\n| New sample?      | no\r\n| Related issues?  | -\r\n\r\n#### What's in this Pull Request?\r\n\r\nI found that with the current implementation it is not possible to provision listitems with recurring dates to a calender list. The reason is that the provisioning framework performs a listitem.Update() after every single field update which in this case triggers causes an exception because the listitem fields depend on each other. I changed the code to update the listitem only once for every DataRow entry.\r\n\r\nThis is the exception:\r\n`Microsoft.SharePoint.Client.ServerException occurred\r\n  HResult=0x80131500\r\n  Message=Invalid data has been used to update the list item. The field you are trying to update may be read only.\r\n  Source=Microsoft.SharePoint.Client.Runtime\r\n  StackTrace:\r\n   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)\r\n   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()\r\n   at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRuntimeContext clientContext, Int32 retryCount, Int32 delay) in F:\\Repos2\\PnP-Sites-Core\\Core\\OfficeDevPnP.Core\\AppModelExtensions\\ClientContextExtensions.cs:line 83\r\n   at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryRetry(ClientRuntimeContext clientContext, Int32 retryCount, Int32 delay) in F:\\Repos2\\PnP-Sites-Core\\Core\\OfficeDevPnP.Core\\AppModelExtensions\\ClientContextExtensions.cs:line 39\r\n   at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectListInstanceDataRows.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, ProvisioningTemplateApplyingInformation applyingInformation) in F:\\Repos2\\PnP-Sites-Core\\Core\\OfficeDevPnP.Core\\Framework\\Provisioning\\ObjectHandlers\\ObjectListInstanceDataRows.cs:line 203\r\n   at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation provisioningInfo) in F:\\Repos2\\PnP-Sites-Core\\Core\\OfficeDevPnP.Core\\Framework\\Provisioning\\ObjectHandlers\\SiteToTemplateConversion.cs:line 248\r\n   at Microsoft.SharePoint.Client.WebExtensions.ApplyProvisioningTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation applyingInformation) in F:\\Repos2\\PnP-Sites-Core\\Core\\OfficeDevPnP.Core\\AppModelExtensions\\WebExtensions.cs:line 1146\r\n   at ConsoleApplication1.Program.Main(String[] args) in F:\\Repos2\\PnP-Sites-Core\\Core\\ConsoleApp1\\Program.cs:line 52\r\n-->`\r\n\r\nThe error can be reproduced with the following template:\r\n`<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<pnp:Provisioning xmlns:pnp=\"http://schemas.dev.office.com/PnP/2016/05/ProvisioningSchema\">\r\n  <pnp:Preferences Generator=\"OfficeDevPnP.Core, Version=2.9.1611.0, Culture=neutral, PublicKeyToken=3751622786b357c2\"/>\r\n  <pnp:Templates>\r\n    <pnp:ProvisioningTemplate ID=\"Demo\" Version=\"1\" BaseSiteTemplate=\"STS#0\">\r\n      <pnp:Lists>\r\n        <pnp:ListInstance Title=\"Calendar\" Description=\"\" DocumentTemplate=\"\" OnQuickLaunch=\"true\" TemplateType=\"106\" Url=\"Lists/Calendar\" MinorVersionLimit=\"0\" MaxVersionLimit=\"0\" DraftVersionVisibility=\"0\" TemplateFeatureID=\"00bfea71-ec85-4903-972d-ebe475780106\" ContentTypesEnabled=\"true\" EnableFolderCreation=\"false\">\r\n          <pnp:DataRows>\r\n            <pnp:DataRow>\r\n              <pnp:DataValue FieldName=\"Title\">Christmas day</pnp:DataValue>\r\n              <pnp:DataValue FieldName=\"EventDate\">2016.12.25 00:00:00</pnp:DataValue>\r\n              <pnp:DataValue FieldName=\"EndDate\">2165.12.25 23:59:00</pnp:DataValue>\r\n              <pnp:DataValue FieldName=\"fAllDayEvent\">1</pnp:DataValue>\r\n              <pnp:DataValue FieldName=\"fRecurrence\">1</pnp:DataValue>\r\n              <pnp:DataValue FieldName=\"EventType\">1</pnp:DataValue>\r\n              <pnp:DataValue FieldName=\"WorkspaceLink\">0</pnp:DataValue>\r\n              <pnp:DataValue FieldName=\"RecurrenceData\">&lt;recurrence&gt;&lt;rule&gt;&lt;firstDayOfWeek&gt;mo&lt;/firstDayOfWeek&gt;&lt;repeat&gt;&lt;yearly yearFrequency=&quot;1&quot; month=&quot;12&quot; day=&quot;25&quot; /&gt;&lt;/repeat&gt;&lt;repeatForever&gt;FALSE&lt;/repeatForever&gt;&lt;/rule&gt;&lt;/recurrence&gt;</pnp:DataValue>\r\n              <pnp:DataValue FieldName=\"UID\">{Guid}</pnp:DataValue>\r\n              <pnp:DataValue FieldName=\"Location\">Location</pnp:DataValue>\r\n            </pnp:DataRow>\r\n          </pnp:DataRows>\r\n        </pnp:ListInstance>\r\n      </pnp:Lists>\r\n    </pnp:ProvisioningTemplate>\r\n  </pnp:Templates>\r\n</pnp:Provisioning>`"},"comment":{"url":"https://api.github.com/repos/SharePoint/PnP-Sites-Core/issues/comments/265707943","html_url":"https://github.com/SharePoint/PnP-Sites-Core/pull/885#issuecomment-265707943","issue_url":"https://api.github.com/repos/SharePoint/PnP-Sites-Core/issues/885","id":265707943,"user":{"login":"jansenbe","id":7451219,"avatar_url":"https://avatars.githubusercontent.com/u/7451219?v=3","gravatar_id":"","url":"https://api.github.com/users/jansenbe","html_url":"https://github.com/jansenbe","followers_url":"https://api.github.com/users/jansenbe/followers","following_url":"https://api.github.com/users/jansenbe/following{/other_user}","gists_url":"https://api.github.com/users/jansenbe/gists{/gist_id}","starred_url":"https://api.github.com/users/jansenbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jansenbe/subscriptions","organizations_url":"https://api.github.com/users/jansenbe/orgs","repos_url":"https://api.github.com/users/jansenbe/repos","events_url":"https://api.github.com/users/jansenbe/events{/privacy}","received_events_url":"https://api.github.com/users/jansenbe/received_events","type":"User","site_admin":false},"created_at":"2016-12-08T10:33:21Z","updated_at":"2016-12-08T10:33:21Z","body":"Good change Sebastian, thanks for your contribution!"}}
{"actor":{"display_login":"jansenbe"}}