Open pjbarry21 opened 5 years ago
I just attached the debugger to the PnP-Sites-Core project to see if something crops up. For the provided template I get lots and lots of exceptions during object property mapping like these in the "Initializing engine" step:
For discoverability as text:
System.ArgumentException
HResult=0x80070057
Message=Object of type 'OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201807.Features' cannot be converted to type 'OfficeDevPnP.Core.Framework.Provisioning.Model.Features'.
Source=mscorlib
StackTrace:
at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
at OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.PnPObjectsMapper.MapProperties(Object source, Object destination, Dictionary`2 resolvers, Boolean recursive) in C:\Repos2\PnP-Sites-Core\Core\OfficeDevPnP.Core\Framework\Provisioning\Providers\Xml\PnPObjectsMapper.cs:line 203
Don't know if this is normal behavior... @PaoloPia @jansenbe is this to be expected? (I'm using the latest dev build and a non-grouped team site on a developer tenant. This also means the template internally is converted to the 2019/03 schema version it seems. Which fails at several points? There are also some dictionary to list type casts that fail.)
The described error occurs when creating a view for list Site Collection Images. The view references the PeopleInMedia
field which is missing on the list.
I think this is the error. The field should exist in the list.
Now I can make this field appear by removing the Video content type from the Site Collection Images list and manually adding it again. The field
PeopleInMedia
suddenly appears. There might be something wrong with provisioning the list content types/fields.
I remember that activating the SharePoint Server Publishing Infrastructure feature took some time. Three questions:
I've got a minimal repro:
Boom.
You know what? SharePoint Online is broken. That's the problem.
The views on Site Collection Images are referencing fields that do not exist.
Try clicking on any of the views:
Nice. No wonder provisioning fails. @VesaJuvonen are there known issues with Publishing features and SharePoint Online?
@heinrich-ulbricht
Wow. Thanks so much for checking and being able to replicate this. Based on what you've found (and confirmed), I pulled up an older site (created on 2/26/19) that I used as a reference for building my new site (on 4/10/19). I do not see these issues on that site. (Ironically, I created this new site because I had done so much mucking around in the 2/26 site and wanted something clean! Sigh.) I can replicate your findings. And the views that error out on the new site (All Assets and Thumbnails), work perfectly on the site created on 2/26/19.
So, going by that site and comparing to the new one, I was able to note that essentially I had content types that had the same name (Video and Video Rendition), but were different (in terms of columns contained in them - many missing in the newly created site). Then I discovered I had TWO versions of both the Video and Video Rendition content types on the new (failing) site. On the new site, the duplicate, but not identical, content types were only visible by going through the Site Collection Images and clicking on the Content Types in there. Audio and Image content types were both identical/fine (on both sites) and led to the same place no matter the path taken. Video and Video Rendition led to 2 different versions (on the new site) -- depending on if you went through the Site Collection Images settings, or if you went into Site Settings and then Site Content Types.
After documenting the differences in the images below, I deleted Video and Video Rendition content types from the Site Collection Images. I then added them both back -- pulling them from the Digital Asset Content Types section. They now appear as they should -- no matter how you get to them.
I then clicked on the Views (Assets and Thumbnails) -- and they both worked with no errors.
There are some images below from when I was digging around (just to see the differences).
I'm now going to try to see if I can make a new PNP template from the "fixed" site and see if I can get it to apply to the same site I tried applying it to before. If that fails, I'll create a new "dummy" site and try applying it (to have a clean slate to start from).
I'm curious, at this point, if this (deleting and re-adding the 2 content types) solves the issue in the template. And will it "fix" (overwrite) the issue when applying it to the already faulty destination site (that got a partial template before failing)? And will it fix/override any site created now (with SP's apparent issues with the publishing feature not getting created correctly for new sites)?
And, as a side note, I'd intentionally turned on Publishing Features for at least one specific reason (that is escaping me now) -- and that's why I'd tried PNPProvisioning. It was touted as working with Publishing Features in a few posts. I'd used another method for creating templates (for modern sites) prior to this, but it didn't work once Publishing Features got turned on. I know I checked into having a site without Publishing Features and it was a no-go (and maybe I'll remember why by the time I post the update). So, yeah, if I felt it was an option to not have that activated, I probably wouldn't even be using PNPProvisioning (just because I had something else working before).
I'll post back after, to share if it failed (are there more issues buried in the newly created site that I just haven't run into yet?) or if that solved it.
Thanks again for diving into this! I'm not at the programmer/debugger level and don't know if I would have eventually found these issues. I know, at the very least, that it would have taken me a lot more time!
This image shows the columns the "bad" Site Collection Image library was missing. The image is from the "good" version on the older site -- with highlights on what I didn't find in Video Type (when being pulled going through the Site Collection Images on the new site):
And this shows the columns missing in the duplicate Video content type (again, image is from the old, working site, with highlights on what was not found on the new site):
Good version of the Video content type:
Broken version of the Video content type:
Looks like there was another one... Continuing the hunt.
So, I cleaned up the new site (as described above -- by cleaning out the "wrong" content types and re-adding them). Also went through and found that Images library had a Document content type (with no columns). This didn't match with the old site (that type wasn't in Images), so I removed it
Ran everything again (same steps as above). Got the same error in the post just before this one. Multiple times.
I went through the whole site and clicked on every View I could find and no errors. I checked every content type in every library and compared it to the old site. No additional differences.
template2.xml.txt log2.xml.txt
I really don't want to duplicate the site from scratch, but I was hoping to have a new site (created from my existing one) up and running first thing next week (we've got departments anxious to get to their new sites). And, even if I do it from scratch, I could still be incorporating issues into a new site -- if the core issue is SharePoint Online and the Publishing Features.
And, just for fun, I turned off SharePoint Server Publishing in Site Features and SharePoint Server Publishing Infrastructure in Site Collection Features. Created a new template and tried applying it. Same error. I'll try it again in the morning -- I've noticed that some setting changes seem to need additional time to cycle through (and maybe I've jumped the gun in assuming those features are truly "off").
@pjbarry21 Glad I could help to get you started. I've got the development environment set up so I can quickly check things. And good to see you are on the issue and evaluate more things. Unfortunately from a PnP perspective I'm not sure if we can do something here if it is indeed broken on a SharePoint level. If this is business critical you should open a ticket with Microsoft to get support.
Thanks, @heinrich-ulbricht
I've resorted to recreating the whole site, minus the publishing features (and some of the setup I want), and then I'll see if it I can get it to work.
And one of the features I wanted, but couldn't remember originally... the ability to use the targeted audience limitations on the Quick Launch menu. It doesn't work when the publishing features are off. Navigation isn't a menu option in site settings without Publishing Features being on (even with Metadata Navigation and Filtering on), and while I can get to the page and make changes that look like they'll work (just by going directly to the URL for the navigation settings: /_layouts/15/AreaNavigationSettings.aspx), the links that shouldn't be visible to some, based on the permissions restrictions I've entered, are still visible. This works on the site with publishing features on (the one I can't make a template of). I know new menu options, including targeting specifically for modern pages/sites, will be released later in the year, but we have sites going live in the next couple of months. So, it's this sort of functionality that I'm trying not to lose while MS works on rolling out replacement features for things that worked in the classic setup, but aren't quite there in the modern sites, yet.
So, my workaround will be to have the template missing a few things, and try to include just the most basic of settings, and then, after duplicating the site (will report if there are any issues now that I've kept publishing features off), I can go in and add half a dozen other tweaks to the newly created site to get back the functionality that I can't seem to have "on" when trying to create a template.
@pjbarry21 I'm looking forward to your reports. Good luck!
@heinrich-ulbricht Thanks! Should have a template test as a first check shortly!
@heinrich-ulbricht
Well, initial test is promising. But ran into hiccups and just unsure if it's a limitation of PNP provisioning (content types weren't copied, folders in the site pages library weren't copied, etc.) or if something went wrong. But no errors and the process showed it as being completed (first time in all my attempts).
I'll do some more research to check on the things that did not get included in the template and I'm also going to try the traditional template method to see if it includes those items (since I've created a template with no publishing features, the standard template method may work, too).
Thanks, again.
Hi, we are having exactly the same issue. How can we surcomvent this?
Apply-PnPProvisioningTemplate : Column 'PeopleInMedia' does not exist. It may have been deleted by another user.
Full debug code
powershell.exe Information: 0 : 2020-08-06 12:30:35.7450 [List instances] [14] [Debug] Creating view All Assets 247824ms 0a6a3aac-9e28-43db-aa28-357fa322441f powershell.exe Error: 0 : 2020-08-06 12:30:36.0422 [OfficeDevPnP.Core] [0] [Error] ExecuteQuery threw following exception: Microsoft.SharePoint.Client.ServerException: Column 'PeopleInMedia' does not exist. It may have been deleted by another user. at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream) at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse() at Microsoft.SharePoint.Client.ClientRequest.<ExecuteQueryToServerAsync>d__6.MoveNext() --- 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.<ExecuteQueryAsync>d__0.MoveNext() --- 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.<ExecuteQueryAsync>d__0.MoveNext() --- 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.<ExecuteQueryAsync>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.SharePoint.Client.ClientContextExtensions.<ExecuteQueryImplementation>d__7.MoveNext() ServerErrorCode: -2147024809 ServerErrorTypeName: System.ArgumentException ServerErrorTraceCorrelationId: f6576d9f-60e7-9000-8f83-8a7fd9b8d3cc ServerErrorValue: ServerErrorDetails: . 0ms powershell.exe Error: 0 : 2020-08-06 12:30:36.0695 [List instances] [14] [Error] Creating view failed: Column 'PeopleInMedia' does not exist. It may have been deleted by another user. : at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream) at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse() at Microsoft.SharePoint.Client.ClientRequest.<ExecuteQueryToServerAsync>d__6.MoveNext() --- 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.<ExecuteQueryAsync>d__0.MoveNext() --- 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.<ExecuteQueryAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.SharePoint.Client.ClientContextExtensions.<ExecuteQueryImplementation>d__7.MoveNext() ServerErrorCode: -1 ServerErrorTypeName: Microsoft.Online.SharePoint.Common.SpoException ServerErrorTraceCorrelationId: 2b566d9f-d0bf-9000-9142-8bcb9f3e04e5 powershell.exe Information: 0 : 2020-08-06 12:26:22.4402 [List instances] [14] [Debug] Updating list Workflow Tasks with FieldRef Status 212915ms 0a6a3aac-9e28-43db-aa28-357fa322441f powershell.exe Information: 0 : 2020-08-06 12:26:23.1149 [List instances] [14] [Debug] Updating list Workflow Tasks with FieldRef PercentComplete 213594ms 0a6a3aac-9e28-43db-aa28-357fa322441f powershell.exe Information: 0 : 2020-08-06 12:26:23.7478 [List instances] [14] [Debug] Updating list Workflow Tasks with FieldRef AssignedTo 214237ms 0a6a3aac-9e28-43db-aa28-357fa322441f at Microsoft.SharePoint.Client.ClientObjectExtensions.<EnsurePropertiesImplementation>d__8
1.MoveNext()
--- 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.ClientObjectExtensions.EnsureProperties[T](T clientObject, Expression`1[] propertySelector)
at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectListInstance.CreateView(Web web, View view, ViewCollection existingViews, List createdList, PnPMonitoredScope monitoredScope, TokenParser parser, Int32 currentViewIndex, Int32 total) 248148ms 0a6a3aac-9e28-43db-aa28-357fa322441f
powershell.exe Information: 0 : 2020-08-06 12:30:36.0735 [List instances] [14] [Debug] Code execution scope ended 248153ms 0a6a3aac-9e28-43db-aa28-357fa322441f
powershell.exe Information: 0 : 2020-08-06 12:30:36.0745 [ProvisioningTemplate WebHook Call] [14] [Debug] Code execution scope started 0ms 0a6a3aac-9e28-43db-aa28-357fa322441f
powershell.exe Information: 0 : 2020-08-06 12:30:36.0745 [ProvisioningTemplate WebHook Call] [14] [Debug] Code execution scope ended 0ms 0a6a3aac-9e28-43db-aa28-357fa322441f
powershell.exe Information: 0 : 2020-08-06 12:30:36.0755 [Provisioning] [14] [Debug] Code execution scope ended 1878623ms 0a6a3aac-9e28-43db-aa28-357fa322441f
Apply-PnPProvisioningTemplate : Column 'PeopleInMedia' does not exist. It may have been deleted by another user.
At line:1 char:1
+ CategoryInfo : WriteError: (:) [Apply-PnPProvisioningTemplate], ServerException
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.Site.ApplyProvisioningTemplate`
Looking forward hearing from you. @pjbarry21 , did you eventually solve it? @heinrich-ulbricht , let me know if you need more info.
thanks, Wouter
Category
[x] Bug [ ] Enhancement
Environment
[x] Office 365 / SharePoint Online [ ] SharePoint 2016 [ ] SharePoint 2013
Expected or Desired Behavior
Trying to apply a template from one site to another site using PNP.
Creating the template using
Connect-PnPOnline –Url https://sitename.sharepoint.com/sites/Group-Template –Credentials (Get-Credential)
Get-PnPProvisioningTemplate -Out "C:\PNPTemplate\template.xml" -PersistBrandingFiles -PersistPublishingFiles;
Then, I created a new TeamSite (modern experience, with no attached group -- just like the site that I used to create the template).
Use this code to apply the template:
Connect-PnPOnline -Url "https://sitename.sharepoint.com/sites/IT-Temp-Test" -Credentials WCMStoredCredentials
Set-PnPTraceLog -On -LogFile "C:\PNPTemplate\log.xml" -Level Debug
Apply-PnPProvisioningTemplate -Path "C:\PNPTemplate\template.xml" -ClearNavigation -IgnoreDuplicateDataRowErrors
Observed Behavior
Appears to run successfully for a long period (12 minutes or so), then this error appears:
These are the error lines in the log file:
Using: SharePointPnPPowerShellOnline 3.8.1904.0
Steps to Reproduce
I've tried with various switches and no switches (when applying). Always fails with the same error. I've checked the site I used to create the template.
<Field ID="{BCD999A7-9DCA-4824-A515-878BEE641ED3}" SourceID="http://schemas.microsoft.com/sharepoint/v3" Name="PeopleInMedia" DisplayName="People In Video" Description="The people appearing in the video." StaticName="PeopleInMedia" Group="_Hidden" Type="UserMulti" Mult="TRUE" List="UserInfo" ShowField="ImnName" Hidden="FALSE" ShowInNewForm="TRUE" ShowInEditForm="TRUE" />
Also, this is not one of the content types or columns that I tweaked in the site I'm trying to copy. I have not touched the video content type or its columns.
I'd had other errors with content types (renamed a couple built-in types and created a new one with a built-in name) and when I reverted those (all site pages), I no longer got those errors. But there's nothing for me to "undo" with this content type or column.
The new site that I try to apply this to is functional, but the template is not fully applied.
Found a similar report (at least in error wording) in issue #2038. But in that ticket, the author says "it appears that the site column is omitted in the pnp:FieldRefs section of the template."
And digging into my template, I see the PeopleinMedia column in the pnp:FieldRefs section (line 1160 and 1540). So, adding it to try to work around it won't help.
Any thoughts on a workaround or something else to test?
Thanks!
template-debug.xml.txt log-debug.xml.txt