Forum Discussion

buszi99's avatar
buszi99
Brass Contributor
Jun 19, 2023

Invoke-PnPSiteTemplate Exception from HRESULT: 0x8107140F

Hi i get this error when i try to invoke PnP site template: Invoke-PnPSiteTemplate : Exception from HRESULT: 0x8107140F. 

Code here

# eskport
$SiteURL = "SP Page link"
Connect-PnPOnline -Url $SiteURL -Interactive
Set-PnPSite -Identity $SiteURL -NoScriptSite $false
Invoke-PnPSiteTemplate -Path C:\Users\Kamil\Desktop\skrypty\xd3\OutputTemplate.xml

 

 

I create a template with this code

 

 

 

# impoort strony jako template

$SiteURL = "SP Page link"
Set-PnPSite -Identity $SiteURL -NoScriptSite $false
Connect-PnPOnline -Url $SiteURL -Interactive
Get-PnPSiteTemplate -Out C:\Users\Kamil\Desktop\skrypty\xd3\OutputTemplate.xml -PersistBrandingFiles -IncludeSiteGroups -IncludeHiddenLists

 

 

Please help.

  • LeonPavesic's avatar
    LeonPavesic
    Silver Contributor

    Hi buszi99,

    The error message you received, "Exception from HRESULT: 0x8107140F," indicates that there was an issue while invoking the PnP site template. This error code typically suggests that the site template you are trying to apply contains components that are not allowed or supported on the target site.

    To troubleshoot this issue, you can try the following steps:

    1. Ensure that you have the latest version of the PnP PowerShell module installed. You can update the module by running the following command:

      Update-Module -Name SharePointPnPPowerShellOnline

    2. Verify that the template file you are using (OutputTemplate.xml) is valid and does not have any issues. You can open the XML file and inspect its contents to ensure it is well-formed and complete.

    3. Check the compatibility of the template with the target site. Certain features or components in the template might not be supported on the target site, causing the error. Make sure the target site has the necessary features and configurations to support the template you are applying.

    4. If you suspect that a specific component in the template is causing the issue, you can try excluding it during the template export or removing it from the XML file before invoking the template. This way, you can identify which component is causing the error and troubleshoot accordingly.

    5. Ensure that you have the necessary permissions and administrative rights to apply the site template. Depending on the features and settings involved, you may require appropriate permissions to execute the template successfully.

      Kindest regards

Resources