sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Set-PnPSite throws error: "The type of data at position nnnn is different than the one expected"

Open fjaeger1986 opened this issue 2 years ago • 10 comments

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

other (enter in the "Additional environment details" area below)

Developer environment

Windows

What browser(s) / client(s) have you tested

  • [ ] 💥 Internet Explorer
  • [ ] 💥 Microsoft Edge
  • [ ] 💥 Google Chrome
  • [ ] 💥 FireFox
  • [ ] 💥 Safari
  • [ ] mobile (iOS/iPadOS)
  • [ ] mobile (Android)
  • [ ] not applicable
  • [ ] other (enter in the "Additional environment details" area below)

Additional environment details

Windows PowerShell locally -> PnP 2.2.0/2.3.0 Azure Function -> PPnP 2.2.0/2.3.0

Describe the bug / error

For a few days running Set-PnP(Tenant)Site with the DisableSharingForNonOwners switch results in an error "The type of data at position 3331 is different than the one expected". (The position number varies.) Multiple tenancies are affected.

Disable-PnPSharingForNonOwnersOfSite -Identity https://tenant.sharepoint.com/sites/oursite is also failing

Set-PnPSite -Identity https://xxx.sharepoint.com/sites/xxx -DisableSharingForNonOwners

Steps to reproduce

Disable-PnPSharingForNonOwnersOfSite -Identity https://tenant.sharepoint.com/sites/oursite Set-PnPSite -Identity https://xxx.sharepoint.com/sites/xxx -DisableSharingForNonOwners

From https://github.com/pnp/powershell/issues/3697#issuecomment-1900564475

Office365Tenant office365Tenant = new Office365Tenant(context); context.Load(office365Tenant); office365Tenant.DisableSharingForNonOwnersOfSite(siteUrl); context.ExecuteQueryRetry();

Expected behavior

Should Disable Sharing For Non Owners ;)

fjaeger1986 avatar Jan 22 '24 11:01 fjaeger1986

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ghost avatar Jan 22 '24 11:01 ghost

This is also occurring for our team. It was functional before.

Sean-LM avatar Jan 25 '24 19:01 Sean-LM

I am working on an implementation for an automated extended spo property sync: https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online

I am using a timer triggered durable function (Isolated .Net 8), the action is happening in an activity function:

        Office365Tenant tenant = new Office365Tenant(_ctx);
        _ctx.Load(tenant);
        _ctx.ExecuteQuery();

Following exception gets thrown on ...ExecuteQuery() line:

System.InvalidOperationException: The type of data at position 3331 is different than the one expected.

L4TDTBP avatar Jan 25 '24 23:01 L4TDTBP

Also having the exact same error but we are using c# https://github.com/pnp/pnpframework

using (var ctx = new AuthenticationManager().GetACSAppOnlyContext(SITE_URL, CLIENT_ID, CLIENT_SECRET))
{
    Office365Tenant tenant = new Office365Tenant(ctx);
    ctx.Load(tenant);
    ctx.ExecuteQuery(); // errors here
}

https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online

https://learn.microsoft.com/en-us/previous-versions/office/sharepoint-csom/jj193041(v=office.15)?redirectedfrom=MSDN

I have reported this problem to Microsoft Support and it's been given a priority C.

cluber22 avatar Jan 30 '24 15:01 cluber22

Same here. When I use Fiddler I can see that the POST to /_vti_bin/client.svc/ProcessQuery that returns the Office365Tenant object does return with a HTTP 200. It contains all the right properties for the object in json:

[
{
"SchemaVersion":"15.0.0.0","LibraryVersion":"16.0.24517.12007","ErrorInfo":null,"TraceCorrelationId":"3c1607a1-4018-8000-14fd-1c20f49c47f6"
},2,{
"IsNull":false
},3,{
"_ObjectType_":"Microsoft.Online.SharePoint.TenantManagement.Office365Tenant","

It is the Microsoft.SharePoint.Client object that fails while interpreting the returned json:


   at Microsoft.SharePoint.Client.JsonReader.ReadString()
   at Microsoft.SharePoint.Client.JsonReader.Read[T]()
   at Microsoft.SharePoint.Client.JsonReader.ReadList[T]()
   at Microsoft.Online.SharePoint.TenantManagement.Office365Tenant.InitOnePropertyFromJson(String peekedName, JsonReader reader)
   at Microsoft.SharePoint.Client.ClientObject.FromJson(JsonReader reader)
   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
   at Microsoft.SharePoint.Client.ClientRequest.<ExecuteQueryToServerAsync>d__53.MoveNext()
   at Microsoft.SharePoint.Client.ClientRequest.<ExecuteQueryAsync>d__39.MoveNext()
   at Microsoft.SharePoint.Client.ClientRuntimeContext.<ExecuteQueryAsync>d__57.MoveNext()
   at Microsoft.SharePoint.Client.ClientContext.<ExecuteQueryAsync>d__23.MoveNext()
   at Microsoft.SharePoint.Client.ClientContextExtensions.<ExecuteQueryImplementation>d__6.MoveNext()
   at Program.<<Main>$>d__0.MoveNext() in C:\source\ConsoleApp2\ConsoleApp2\Program.cs:line 14

Interestingly enough the property that's around the 3300-3400 position is probably relatively new since it concerns the Esigntature stuff that was announced at Ignite:

"ESignatureSiteList":[

],"ESignatureSiteListFileName":"","ESignatureThirdPartyProviderInfoList":[ { "ObjectType":"Microsoft.Online.SharePoint.TenantAdministration.EsignatureThirdPartyProvidersInfo","IsEnabled":false,"ProviderName":"DocuSign" },{ "ObjectType":"Microsoft.Online.SharePoint.TenantAdministration.EsignatureThirdPartyProvidersInfo","IsEnabled":false,"ProviderName":"AdobeSign" }

although that of course might be coincidental.

Currently it seems that usage of the Office365Tenant is blocked until the Microsoft.SharePoint.Client library is fixed, or so it seems to me.

JohanKroese avatar Jan 31 '24 11:01 JohanKroese

So support have come back and said they are closing my ticket.

https://learn.microsoft.com/en-US/microsoft-365/troubleshoot/miscellaneous/issue-support-limitations#microsoft-365-subscription-support

I'm going to have to try and escalate it another way.

cluber22 avatar Feb 01 '24 20:02 cluber22

Can confirm that it’s working fine again on PnP PowerShell 2.3.44-nightly.

fjaeger1986 avatar Feb 02 '24 13:02 fjaeger1986

Our system (spanning both GCCH and Commercial) has started to function once again without any code changes. This appears to be fixed on the m365 side.

Sean-LM avatar Feb 12 '24 13:02 Sean-LM

Same - started working again 4 days ago. Bit concerning that this isn't covered by standard support.

cluber22 avatar Feb 12 '24 22:02 cluber22

Thank you for taking the time to file an issue. We periodically archive older or inactive issues as part of our issue management process, which automatically closes them once they are archived.

If you’d like to understand more about why and how we handle archived (closed) issues, please see Our approach to closed issues.

We appreciate your contribution and if this is still an active issue with the latest SPFx versions, please do resubmit the details. We needed to perform a cleanup, so that we can start with a clean table with a new process. We apologize for the inconvenience this might cause.

github-actions[bot] avatar May 03 '25 16:05 github-actions[bot]