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

Export-PnPTermGroupToXml empty for groups in "site collection" term store #3017

Closed
mfxits opened this issue Apr 13, 2023 Discussed in #2988 · 2 comments · Fixed by #3256
Closed

Export-PnPTermGroupToXml empty for groups in "site collection" term store #3017

mfxits opened this issue Apr 13, 2023 Discussed in #2988 · 2 comments · Fixed by #3256
Assignees

Comments

@mfxits
Copy link

mfxits commented Apr 13, 2023

Discussed in #2988

Export-PnPTermGroupToXml produces an empty string when used on term groups in the "site local" term store.

This behavior came up on a customer's live tenant and could be reproduced on a current test tenant.
Term groups in the "global" term store are exported to XML as expected.

Using pnp/pwershell 1.12.0.
Please refer to the discussion cited below.

Originally posted by mfxits April 7, 2023
Hi,

I'm using PnP.Powershell 1.12.0 and want to export a term group from the "site collection term store" of the root site collection.

Let's say the group is named "ABC". It's the only group in the "site local" terms store.

Get-PnpTermGroup lists all groups from the global term store including the local "ABC".
For any global group piped to Export-PnPTermGroupToXml the result is as expected:

Get-PnpTermGroup -Identity "XYZ" | Export-PnPTermGroupToXml

<pnp:TermGroups xmlns:pnp="http://schemas.dev.office.com/PnP/2022/09/ProvisioningSchema">
  <pnp:TermGroup Name="XYZ" ID="8574c038-e187-435d-b2e5-e0520ffafea7" Description="" UpdateBehavior="Overwrite">
    <pnp:TermSets> ... </pnp:TermSets> 
  </pnp:TermGroup>
</pnp:TermGroups>

But when I do the same with "ABC", the result is empty. It doesn't matter if I use the ID or name as parameter for "Identity".

Get-PnpTermGroup -Identity "ABC" | Export-PnPTermGroupToXml

   

Both groups returned from Get-PnpTermGroup have the type "Microsoft.SharePoint.Client.Taxonomy.TermGroup" and I can't see any difference between them.

I also played with Get-PnPSiteCollectionTermStore, but that command just returns the same term group object.

I searched for the topic but found nothing. Can anyone help please?

  • Markus
@AndersRask
Copy link

@KoenZomers seems like the issue is that local term groups are named {sitecollectiontermgroupname} and ID is set to 00000000-0000-0000-0000-000000000000 when Site Template is extracted, so the code fails to match on ID and name for that reason.

Get-PnPSiteTemplate -Handlers TermGroups -IncludeAllTermGroups -IncludeSiteCollectionTermGroup

gives you
<pnp:TermGroup Name="{sitecollectiontermgroupname}" ID="00000000-0000-0000-0000-000000000000" Description="" SiteCollectionTermGroup="true" UpdateBehavior="Overwrite">

Hence this works:

export-PnPTermGroupToXml -Identity "{sitecollectiontermgroupname}"
or
export-PnPTermGroupToXml -Identity 00000000-0000-0000-0000-000000000000

@gautamdsheth gautamdsheth self-assigned this Jul 7, 2023
gautamdsheth pushed a commit to gautamdsheth/powershell that referenced this issue Jul 7, 2023
gautamdsheth added a commit that referenced this issue Jul 7, 2023
Fix #3017 : issue with exporting site collection term group
@gautamdsheth
Copy link
Collaborator

Have fixed this issue, will be available in the nightly builds as well as the next release !

Thank you @mfxits for raising this issue.
Thank you @AndersRask for investigating it.

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 a pull request may close this issue.

3 participants