Pnp-sites-core: Get-SPOProvisioningTemplate fails when calling getDefaultSiteCollection Microsoft.SharePoint.Taxonomy.TaxonomySession.GetTaxonomySession

Created on 20 Oct 2016  Â·  7Comments  Â·  Source: pnp/PnP-Sites-Core

Thank you for reporting an issue or suggesting an enhancement. We appreciate your feedback - to help the team to understand your needs, please complete the below template to ensure we have the necessary details to assist you. If you have a actual question, we would ask you to use PnP Yammer group at http://aka.ms/OfficeDevPnPYammer. Thanks!
#### Which PnP repository to report the issue?

_You can delete this section after you have confirmed target repository for your submission._

Category

[X ] Bug
[ ] Enhancement

Environment

[ ] Office 365 / SharePoint Online
[ ] SharePoint 2016
[X ] SharePoint 2013

If SharePoint on-premises, what's exact CU version: August 2016 CU

Expected or Desired Behavior

Get-SPOProvisioningTemplate to extract a template from a site

Observed Behavior

I get this error 👎

PS C:\Windows\system32> Set-SPOTraceLog -On -Level Debug
PS C:\Windows\system32> get-spoprovisioningtemplate -Out C:\sp2013provisioningtemplate.xml
powershell.exe Error: 0 : 2016-10-20 13:57:31.1188 [Provisioning] [0] [Error] Error occured while retrieving b
asetemplate 0ms
powershell.exe Error: 0 : 2016-10-20 13:57:31.1548 [Provisioning] [0] [Error] Error occured while retrieving b
asetemplate 0ms
powershell.exe Information: 0 : 2016-10-20 13:57:31.1553 [Extraction] [8] [Debug] Code execution scope sta
rted 0ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:31.1558 [Extraction] [8] [Debug] ProgressDelegate registe
red 0ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:31.1563 [Extraction] [8] [Debug] MessagesDelegate registe
red 1ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:31.7343 [Regional Settings] [8] [Debug] Code execution s
cope started 0ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:31.8013 [Regional Settings] [8] [Debug] Code execution s
cope ended 66ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:31.8093 [Supported UI Languages] [8] [Debug] Code exe
cution scope started 0ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:31.8813 [Supported UI Languages] [8] [Debug] Code exe
cution scope ended 72ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:31.9283 [Audit Settings] [8] [Debug] Code execution s
cope started 0ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:32.0247 [Audit Settings] [8] [Debug] Code execution s
cope ended 95ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:32.0347 [Site Security] [8] [Debug] Code execution scope sta
rted 0ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:32.5192 [Site Security] [8] [Debug] Skipping OOTB role defin
ition Full Control 484ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:32.5197 [Site Security] [8] [Debug] Skipping OOTB role defin
ition Design 484ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:32.5202 [Site Security] [8] [Debug] Skipping OOTB role defin
ition Edit 485ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:32.5207 [Site Security] [8] [Debug] Skipping OOTB role defin
ition Contribute 485ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:32.5212 [Site Security] [8] [Debug] Skipping OOTB role defin
ition Read 486ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:32.5217 [Site Security] [8] [Debug] Skipping OOTB role defin
ition Limited Access 487ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:32.5222 [Site Security] [8] [Debug] Processing custom role d
efinition Approve 487ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:32.5227 [Site Security] [8] [Debug] Processing custom role d
efinition Manage Hierarchy 488ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:32.5232 [Site Security] [8] [Debug] Processing custom role d
efinition Restricted Read 488ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:32.5237 [Site Security] [8] [Debug] Processing custom role d
efinition Restricted Interfaces for Translation 489ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:32.5242 [Site Security] [8] [Debug] Processing custom role d
efinition View Only 489ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:32.5247 [Site Security] [8] [Debug] Processing custom role d
efinition Records Center Web Service Submitters 490ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:32.5252 [Site Security] [8] [Debug] Processing custom role d
efinition Moderate 490ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:32.5787 [Site Security] [8] [Debug] Code execution scope end
ed 544ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:32.5812 [Fields] [8] [Debug] Code execution scope sta
rted 0ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:33.2102 [Fields] [8] [Debug] Code execution scope end
ed 621ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
powershell.exe Information: 0 : 2016-10-20 13:57:33.2102 [Extraction] [8] [Debug] Code execution scope end
ed 2055ms 47416cb2-d57c-4faf-bcdc-5ee3919711f4
get-spoprovisioningtemplate : Cannot invoke method or retrieve property from null object. Object returned by the
following call stack is null. "GetDefaultSiteCollectionTermStore
Microsoft.SharePoint.Taxonomy.TaxonomySession.GetTaxonomySession
"
At line:1 char:1

  • get-spoprovisioningtemplate -Out C:\sp2013provisioningtemplate.xml
  • ~~~~~~~~~~~~~~

    • CategoryInfo : WriteError: (:) [Get-SPOProvisioningTemplate], ServerException

    • FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.GetProvisioningTemplate

PS C:\Windows\system32>

Steps to Reproduce

run Get-SPOProvisioningTemplate

Thanks for your contribution! Sharing is caring.

Most helpful comment

Hello.
Assuming you are accessing an on-prem farm... (you said SP2013). I reckon
your problem is that the MMS isn't correctly configured. Check if your MMS
Service app proxy has the option 'This service application is the default
storage location for column specific term sets'. I believe this option
isn't selected when you create the app via the UI.

[image: Image result for Managed metadata service default store]
https://www.google.com.au/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&cad=rja&uact=8&ved=0ahUKEwjI5aHL1dHQAhXCoJQKHYqSDXIQjRwIBw&url=http%3A%2F%2Fsureshpydi.blogspot.in%2F2013%2F04%2Fsharepoint-2013-configure-managed.html&psig=AFQjCNHeRS7y6KrcZi-_Ju937r8-9ykBRA&ust=1480636105666801

On Thu, Dec 1, 2016 at 5:26 AM, jboby notifications@github.com wrote:

I'm having a couple of issues here :
I'm using the latest rev of the code and attempting to build a template
from a newly created 2013 Teams Site collection:

When processing Fields ...
Error:
'Cannot invoke method or retrieve property from n
ull object. Object returned by the following call stack is null.
"GetDefaultSite
CollectionTermStore
Microsoft.SharePoint.Taxonomy.TaxonomySession.GetTaxonomySession
"'.
Stack Trace: '
at Microsoft.SharePoint.Client.ClientRequest.ProcessRespons
eStream(Stream responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(
ChunkString
Builder sb)
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContextExtensions.
ExecuteQueryImplementa
tion(ClientRuntimeContext clientContext, Int32 retryCount, Int32 delay) in
C:\Pr
ojects\PNPTrunk\Core\OfficeDevPnP.Core\AppModelExtensions\
ClientContextExtension
s.cs:line 85'

And .. when processing Page Contents ...
Error:
'Specified argument was out of the range of valid values.
Parameter name: controlId'.
Stack Trace: '
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream
responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(
ChunkString
Builder sb)
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContextExtensions.
ExecuteQueryImplementa
tion(ClientRuntimeContext clientContext, Int32 retryCount, Int32 delay) in
C:\Pr
ojects\PNPTrunk\Core\OfficeDevPnP.Core\AppModelExtensions\
ClientContextExtension
s.cs:line 85'

And, presumably, since the previous item fails ...
Error:
The property or field 'Id' has not been initialized.
It has not been requested or the request has not been executed. It may
need to
be explicitly requested..
Stack Trace:
at Microsoft.SharePoint.Client.ClientO
bject.CheckUninitializedProperty(String propName)
at Microsoft.SharePoint.Client.WebParts.WebPartDefinition.get_Id()
at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.
ObjectPageContents
.ExtractObjects(Web web, ProvisioningTemplate template,
ProvisioningTemplateCrea
tionInformation creationInfo)

Please help. This has been driving me nuts!!

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/SharePoint/PnP-Sites-Core/issues/812#issuecomment-263953218,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIinrFjJLf1fTGtqr3o_UsgnKHpgpikgks5rDb_VgaJpZM4KcGhi
.

All 7 comments

Hi NPrice99

I had the same issue. If you take a look a bit closer to the stacktrace you will see some pretty standard Microsoft related stuff. Although the framework throws the error it has nothing to do with it.

following call stack is null. "GetDefaultSiteCollectionTermStore
Microsoft.SharePoint.Taxonomy.TaxonomySession.GetTaxonomySession

I quickly found the solution:

  • Go to the managed Metadata service (Central Admin -> Service Applications)
  • Select Managed Metadata Service Proxy and click Properties (button in the ribbon).
  • Check option "this application is default storage for keywords and for termsets".
  • Try again and it should work

tnx to google and source: stackoverflow.com

Hello.
Assuming you are accessing an on-prem farm... (you said SP2013). I reckon
your problem is that the MMS isn't correctly configured. Check if your MMS
Service app proxy has the option 'This service application is the default
storage location for column specific term sets'. I believe this option
isn't selected when you create the app via the UI.

[image: Image result for Managed metadata service default store]
https://www.google.com.au/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&cad=rja&uact=8&ved=0ahUKEwjI5aHL1dHQAhXCoJQKHYqSDXIQjRwIBw&url=http%3A%2F%2Fsureshpydi.blogspot.in%2F2013%2F04%2Fsharepoint-2013-configure-managed.html&psig=AFQjCNHeRS7y6KrcZi-_Ju937r8-9ykBRA&ust=1480636105666801

On Thu, Dec 1, 2016 at 5:26 AM, jboby notifications@github.com wrote:

I'm having a couple of issues here :
I'm using the latest rev of the code and attempting to build a template
from a newly created 2013 Teams Site collection:

When processing Fields ...
Error:
'Cannot invoke method or retrieve property from n
ull object. Object returned by the following call stack is null.
"GetDefaultSite
CollectionTermStore
Microsoft.SharePoint.Taxonomy.TaxonomySession.GetTaxonomySession
"'.
Stack Trace: '
at Microsoft.SharePoint.Client.ClientRequest.ProcessRespons
eStream(Stream responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(
ChunkString
Builder sb)
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContextExtensions.
ExecuteQueryImplementa
tion(ClientRuntimeContext clientContext, Int32 retryCount, Int32 delay) in
C:\Pr
ojects\PNPTrunk\Core\OfficeDevPnP.Core\AppModelExtensions\
ClientContextExtension
s.cs:line 85'

And .. when processing Page Contents ...
Error:
'Specified argument was out of the range of valid values.
Parameter name: controlId'.
Stack Trace: '
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream
responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(
ChunkString
Builder sb)
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContextExtensions.
ExecuteQueryImplementa
tion(ClientRuntimeContext clientContext, Int32 retryCount, Int32 delay) in
C:\Pr
ojects\PNPTrunk\Core\OfficeDevPnP.Core\AppModelExtensions\
ClientContextExtension
s.cs:line 85'

And, presumably, since the previous item fails ...
Error:
The property or field 'Id' has not been initialized.
It has not been requested or the request has not been executed. It may
need to
be explicitly requested..
Stack Trace:
at Microsoft.SharePoint.Client.ClientO
bject.CheckUninitializedProperty(String propName)
at Microsoft.SharePoint.Client.WebParts.WebPartDefinition.get_Id()
at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.
ObjectPageContents
.ExtractObjects(Web web, ProvisioningTemplate template,
ProvisioningTemplateCrea
tionInformation creationInfo)

Please help. This has been driving me nuts!!

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/SharePoint/PnP-Sites-Core/issues/812#issuecomment-263953218,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIinrFjJLf1fTGtqr3o_UsgnKHpgpikgks5rDb_VgaJpZM4KcGhi
.

@camiloborges solution works. The error disappears immediately when the service application is the default storage location.

This is indeed related to missing setup. We recently made the handle this setup error gracefully without crashing (will be in feb 2017 release). Closing this issue now

@jansenbe was this fixed? I am trying to export on a site and am getting the same error with the April release

In further testing, this error was occurring when extracting lists with the Metadata Navigation and Filtering feature turned on for the site. By turning off that feature I was able to get the template to work.

I'm still getting this error with the latest release (2.19.1710.2) so it doesn't look as if it has been patched to fail gracefully

Will step through the remedies posted in this thread

I am still getting this error on October 2018 Release for SP Server 2016. Unfortunately the workar steps above won’t work for me because the Managed Metedata Service comes from another farm that I can not control.

Was this page helpful?
0 / 5 - 0 ratings