{"action":"created","issue":{"url":"https://api.github.com/repos/OfficeDev/PnP-Sites-Core/issues/630","repository_url":"https://api.github.com/repos/OfficeDev/PnP-Sites-Core","labels_url":"https://api.github.com/repos/OfficeDev/PnP-Sites-Core/issues/630/labels{/name}","comments_url":"https://api.github.com/repos/OfficeDev/PnP-Sites-Core/issues/630/comments","events_url":"https://api.github.com/repos/OfficeDev/PnP-Sites-Core/issues/630/events","html_url":"https://github.com/OfficeDev/PnP-Sites-Core/issues/630","id":160647718,"number":630,"title":"Applying a provisioning template to a sub site fails - startIndex cannot be larger than length of string","user":{"login":"tommykri","id":5443815,"avatar_url":"https://avatars.githubusercontent.com/u/5443815?v=3","gravatar_id":"","url":"https://api.github.com/users/tommykri","html_url":"https://github.com/tommykri","followers_url":"https://api.github.com/users/tommykri/followers","following_url":"https://api.github.com/users/tommykri/following{/other_user}","gists_url":"https://api.github.com/users/tommykri/gists{/gist_id}","starred_url":"https://api.github.com/users/tommykri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tommykri/subscriptions","organizations_url":"https://api.github.com/users/tommykri/orgs","repos_url":"https://api.github.com/users/tommykri/repos","events_url":"https://api.github.com/users/tommykri/events{/privacy}","received_events_url":"https://api.github.com/users/tommykri/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-06-16T12:18:30Z","updated_at":"2016-06-17T07:59:55Z","closed_at":null,"body":"#### Which PnP repository to report the issue?\r\n- PnP Sites Core - https://github.com/OfficeDev/PnP-Sites-Core\r\n\r\n#### Category\r\n[x] Bug\r\n[ ] Enhancement\r\n\r\n#### Environment\r\n[ ] Office 365 / SharePoint Online\r\n[ ] SharePoint 2016\r\n[x] SharePoint 2013\r\n\r\nIf SharePoint on-premises, what's exact CU version: \r\nFebruary 2016 Cumulative Update for SharePoint 2013\r\n\r\n#### Expected or Desired Behavior\r\nI expect to be able to apply a provisioning template to a sub site using nuget package SharePointPnPCore2013 version 2.5.1606.1\r\n\r\n#### Observed Behavior\r\nWhen applying a provisioning template to a sub site I get the following exception\r\n\r\n`startIndex cannot be larger than length of string.\\r\\nParameter name: startIndex\r\n   at System.String.Substring(Int32 startIndex, Int32 length)\r\n   at System.String.Substring(Int32 startIndex)\r\n   at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.TokenParser..ctor(Web web, ProvisioningTemplate template)\r\n   at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation provisioningInfo)\r\n   at Microsoft.SharePoint.Client.WebExtensions.ApplyProvisioningTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation applyingInformation)\r\n   at ApplyTemplateToSubSiteBug.Program.Main(String[] args) in c:\\users\\sp_admin.dev\\documents\\visual studio 2015\\Projects\\ApplyTemplateToSubSiteBug\\ApplyTemplateToSubSiteBug\\Program.cs:line 27`\r\n   \r\nIt it failing on line 74 on https://github.com/OfficeDev/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/Framework/Provisioning/ObjectHandlers/TokenParser.cs when trying to add a list url token from the root web.\r\n\r\nI have only been able to test this on-premises but I guess the same will apply to SharePoint Online.\r\n\r\n#### Steps to Reproduce\r\nA console application is available here which can be run to reproduce:\r\nhttps://github.com/tommykri/SubSiteProvisioningBug"},"comment":{"url":"https://api.github.com/repos/OfficeDev/PnP-Sites-Core/issues/comments/226705758","html_url":"https://github.com/OfficeDev/PnP-Sites-Core/issues/630#issuecomment-226705758","issue_url":"https://api.github.com/repos/OfficeDev/PnP-Sites-Core/issues/630","id":226705758,"user":{"login":"tommykri","id":5443815,"avatar_url":"https://avatars.githubusercontent.com/u/5443815?v=3","gravatar_id":"","url":"https://api.github.com/users/tommykri","html_url":"https://github.com/tommykri","followers_url":"https://api.github.com/users/tommykri/followers","following_url":"https://api.github.com/users/tommykri/following{/other_user}","gists_url":"https://api.github.com/users/tommykri/gists{/gist_id}","starred_url":"https://api.github.com/users/tommykri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tommykri/subscriptions","organizations_url":"https://api.github.com/users/tommykri/orgs","repos_url":"https://api.github.com/users/tommykri/repos","events_url":"https://api.github.com/users/tommykri/events{/privacy}","received_events_url":"https://api.github.com/users/tommykri/received_events","type":"User","site_admin":false},"created_at":"2016-06-17T07:59:55Z","updated_at":"2016-06-17T07:59:55Z","body":"Hi\r\n\r\nWith the june release I'm able to reproduce this against SharePoint Online as well. I have updated my sample repo https://github.com/tommykri/SubSiteProvisioningBug to run against SharePoint Online.\r\n\r\n#625 fixed the issue of getting an exception but I don't think the tokenparser resolves list url's from the root web correctly as the url's will be resolved as:\r\n- \"tyle Library\"\r\n- \"catalogs/theme\"\r\n- \"ists/SharePointHomeOrgLinks\"\r\n\r\nThe beginning of the url will be stripped. Not sure how the url should be resolved as but shouldn't it be:\r\n\r\n```\r\n _tokens.Add(new ListUrlToken(web, rootList.Title, rootList.RootFolder.ServerRelativeUrl));\r\n```\r\n\r\n So the url's will be resolved as:\r\n- \"/style Library\"\r\n- \"/_catalogs/theme\"\r\n- \"/lists/SharePointHomeOrgLinks\""}}
{"actor":{"display_login":"tommykri"}}