-
Notifications
You must be signed in to change notification settings - Fork 360
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
Add field to content type throws error content type has no children [BUG] #1092
Comments
Continuing on I just tried this thinking that maybe it had something to do with it being the default content type but this didn't work either
I have since run another test, whereby I created a new document library in the same site collection PnPIssueTest2 and added the site content type ContentTypeB to the library first and then added ContentTypeA ran the same script as before and it successfully added the field to ContentTypeB but not ContentTypeA. ContentTypeA is still the default content type.
|
Hi @pvranich , have added additional parameter |
Hi All, I will start but saying I think this is the right place to log the issue. If it should go in the pnp framework issues please let me know and i will move it there.
Reporting an Issue or Missing Feature
Ultimately the issue is when trying to add a list field\column to a list content type I get the following error
The content type has no children.
Cmdlet called is Add-PnPFieldToContentType
Now that being said, I have two content types in my library and it consistently adds the field to one content type, which happens to be the default content type, but consistently fails when trying to add the field to any other subsequent content types with the message above.
Neither content types have any children. So not really sure why it is even trying to do that and 2 it still works on the default content type even though it has no children.
There is no parameter on the cmdlet to updatechildren $true$false so I am guessing this is always set to $true? If I look at the source code this seems to be the case.
Expected behavior
The field is successfully added to the content type.
Actual behavior
When calling Add-PnPFieldToContentType with a field object it fails with the message The content type has no children.
and the field is not added to the content type.
Steps to reproduce behavior
Create two site content types, ContentTypeA and ContentTypeB, inheriting from Document and add both these content types to a library. Remove the Document content type from the library. Set ContentTypeA as the default content type.
I have a collection of fields and their schema xml that I am trying to add to the list and then to the content types. It doesn't matter what sort of field. for example:
What is the version of the Cmdlet module you are running?
1.7.0
Which operating system/environment are you running PnP PowerShell on?
The text was updated successfully, but these errors were encountered: