[ ] Bug
[x] Enhancement
[ ] Page Transformation: Error during the setup/use of the Page Transformation UI solution (did you check our troubleshooting guide?)
[x] Page Transformation: Error during the use of page transformation from PnP PowerShell
[x] Page Transformation: Error during the use of page transformation from .Net
[ ] Page Transformation: Page is not looking correct after transformation
[ ] Modernization Scanner: something went wrong...
It should be allowed to copy metadata for wiki pages when doing transformation across site collections/tenants.
Currently, not able to copy metadata for wiki pages when doing transformation across site collections.
The page is correctly transformed and have no issues or errors, however the metadata for these pages is not copied over.
Please let me know if I could be missing something quite simple or might have completely missed something.
I am using the below code in SPO. Both the source and destination site are in SPO and same tenant:
string siteUrl = "https://tenant.sharepoint.com/sites/SourceWikiSite/";
string userName = "user";
AuthenticationManager am = new AuthenticationManager();
using (var cc = am.GetSharePointOnlineAuthenticatedContextTenant(siteUrl, userName, "password"))
{
var targetContext = cc.Clone("https://tenant.sharepoint.com/sites/DestSite");
var pageFile = cc.Web.GetFileByServerRelativeUrl("/sites/SourceWikiSite/SitePages/wikipage101.aspx");
cc.Load(pageFile, p => p.ListItemAllFields);
cc.ExecuteQuery();
var page = pageFile.ListItemAllFields;
PageTransformator pageTransformator = new PageTransformator(cc, targetContext);
PageTransformationInformation pti = new PageTransformationInformation(page)
{
HandleWikiImagesAndVideos = true,
Overwrite = true,
SkipTelemetry = true,
AddTableListImageAsImageWebPart = true,
CopyPageMetadata = true,
};
try
{
Console.WriteLine($"Transforming page {page.FieldValues["FileLeafRef"]}");
pageTransformator.Transform(pti);
}
catch (ArgumentException ex)
{
Console.WriteLine($"Page {page.FieldValues["FileLeafRef"]} could not be transformed: {ex.Message}");
}
}
I am using the latest dev version of the Modernization framework.
Looks like here, we are checking that if it has targetcontext, we wont copy metadata.
If this is indeed not supported at the moment, I would be happy to contribute a PR for the same. Would love discuss the approach for the same, though i guess something similar to what we are doing for Publishing pages would be good enough.
Hey @gautamdsheth ,
Currently this indeed is not possible for wiki/webpart pages, we only support metadata copy for in-place transformations as that point all the fields are always available since we stay in the same library.
If you've time for a PR on this then I'm supporting that:
Happy to further elaborate on this if you want, just let me know. If you want this in the September release time is short, the PR should be in by Friday this week, but targeting the October release is also fine...I'm already more than happy that you want to spent some time on this.
Hey @jansenbe , thanks for the reply :) . Totally makes sense to keep it simple. Will target the October release and follow the approach that you mentioned here. Happy to contribute :)
Hi ,
I`m trying to publish a page from On-prem to SPO tenant - Hub site using Powershell Command (ConvertTo-PnPCientSidePage) and its a custom column - choice field .Page has been successfully created and the mapping file has the mapping specified in the Target Field Name as below.
I`m getting the warning message as
Skipped copying field: News Category
Getting the error as below,However the Page content has been successfully created
Date | Source Page | Operation | Message
------------- | ------------- | ------------- | -------------
13/09/2019 10:31:24 AM | /pages/testpage.aspx | Built-in Function | An error occurred in LoadContentFromFile function at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at Microsoft.SharePoint.Client.ClientRequest.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.ClientRequest.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.ClientRuntimeContext.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.ClientContext.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.ClientContextExtensions.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.FileFolderExtensions.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.FileFolderExtensions.GetFileAsString(Web web, String serverRelativeUrl)
at SharePointPnP.Modernization.Framework.Functions.BuiltIn.LoadContentFromFile(String contentLink)
13/09/2019 10:31:24 AM | /pages/testpage.aspx | Built-in Function | An error occurred in LoadContentFromFile function at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at Microsoft.SharePoint.Client.ClientRequest.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.ClientRequest.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.ClientRuntimeContext.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.ClientContext.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.ClientContextExtensions.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.FileFolderExtensions.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.FileFolderExtensions.GetFileAsString(Web web, String serverRelativeUrl)
at SharePointPnP.Modernization.Framework.Functions.BuiltIn.LoadContentFromFile(String contentLink)
Thx for reporting this @KVSolutions . If I understand things correctly this seems to be related to copying choice fields. I'll create a new issue for this problem as it's not the same as this one.
I assume you've created the same choice field in the target sitepages library on the modern page?
@gautamdsheth : do you still think you get this feature done for the October release? Don't want to push you, but we need this capability for October. You've already helped us a lot via a ton of PR's, if you've no available time for this then I totally understand that and I'll spent time on this myself.
Hey @jansenbe, sure am working on it. Will send a PR sometime in this week. Is that fine? Kinda got distracted because of other PRs
Thanks for this work @gautamdsheth ! I've just tested and merged your PR, so closing this issue now
Most helpful comment
Hey @jansenbe, sure am working on it. Will send a PR sometime in this week. Is that fine? Kinda got distracted because of other PRs