Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for single quote in client side page name #348

Merged
merged 1 commit into from
Mar 11, 2021

Conversation

Sarah4x
Copy link

@Sarah4x Sarah4x commented Mar 10, 2021

Added escape quote before UrlEncoding.

Added escape quote before UrlEncoding
@Sarah4x
Copy link
Author

Sarah4x commented Mar 10, 2021

These errors below are when trying to apply an extracted Contos Global Marketing site template in a Enterprise Demo Tenant.

Error Inner Message >
SharePoint Rest service exception
Error Inner StackTrace >
at PnP.Core.Services.BatchClient.ProcessSharePointRestBatchResponseContent(Batch batch, String batchResponse) in C:\PNPFix\PnP.Core\pnpcore\src\sdk\PnP.Core\Services\Core\BatchClient.cs:line 1144
at PnP.Core.Services.BatchClient.d__51.MoveNext() in C:\PNPFix\PnP.Core\pnpcore\src\sdk\PnP.Core\Services\Core\BatchClient.cs:line 1097
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at PnP.Core.Services.BatchClient.d__49.MoveNext() in C:\PNPFix\PnP.Core\pnpcore\src\sdk\PnP.Core\Services\Core\BatchClient.cs:line 955
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at PnP.Core.Services.BatchClient.d__39.MoveNext() in C:\PNPFix\PnP.Core\pnpcore\src\sdk\PnP.Core\Services\Core\BatchClient.cs:line 316
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at PnP.Core.Model.BaseDataModel1.d__56.MoveNext() in C:\PNPFix\PnP.Core\pnpcore\src\sdk\PnP.Core\Model\Base\BaseDataModel.cs:line 528
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at PnP.Core.Model.SharePoint.Web.d__301.MoveNext() in C:\PNPFix\PnP.Core\pnpcore\src\sdk\PnP.Core\Model\SharePoint\Core\Internal\Web.cs:line 485
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at PnP.Core.Model.SharePoint.Page.<PublishAsync>d__144.MoveNext() in C:\PNPFix\PnP.Core\pnpcore\src\sdk\PnP.Core\Model\SharePoint\Pages\Internal\Page.cs:line 1979 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at PnP.Core.Model.SharePoint.Page.Publish() in C:\PNPFix\PnP.Core\pnpcore\src\sdk\PnP.Core\Model\SharePoint\Pages\Internal\Page.cs:line 1969 at PnP.Framework.Provisioning.ObjectHandlers.ObjectClientSidePages.CreatePage(Web web, ProvisioningTemplate template, TokenParser parser, PnPMonitoredScope scope, BaseClientSidePage clientSidePage, String pagesLibrary, List pagesLibraryList, Int32& currentPageIndex, List1 preCreatedPages)
at PnP.Framework.Provisioning.ObjectHandlers.ObjectClientSidePages.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, ProvisioningTemplateApplyingInformation applyingInformation)
at PnP.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation provisioningInfo, Boolean calledFromHierarchy, TokenParser tokenParser)
at Microsoft.SharePoint.Client.WebExtensions.ApplyProvisioningTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation applyingInformation)

Batch response without fix

--batchresponse_0b2ecd25-3a5e-4d12-b243-1c0122fc3fe8
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 400 Bad Request
CONTENT-TYPE: application/json;odata=verbose;charset=utf-8

{"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"The expression "web/getFolderById('f5f102c5-8aae-426c-9cb4-243d9d91d583')/files/AddTemplateFile(urlOfFile='/sites/GlobalSalesTest/SitePages/What's-the-difference-between-customer-support-and-customer-engagement.aspx',templateFileType=3)" is not valid."}}}
--batchresponse_0b2ecd25-3a5e-4d12-b243-1c0122fc3fe8--

@jansenbe
Copy link
Contributor

Thx @Sarah4x , I've combined your PR with adding further support for special chars like # and & when working with files and folders.

@jansenbe jansenbe merged commit a354935 into pnp:dev Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants