Hello @Harikrishnan P
I may recommend you to give a read to the sintex changes in SharePoint published last month. The "write error" seems like the input is not as expected.
Hope this helps you,
Best regards
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
Has anybody tried using the new command Add-PnPContentTypesFromContentTypeHub to sync content types from the hub to the site collection? I tried to use this command as per the documentation. But I'm getting an error as below.
Add-PnPContentTypesFromContentTypeHub : The type of data at position 249 is different than the one expected.
At line:1 char:1
Hello @Harikrishnan P
I may recommend you to give a read to the sintex changes in SharePoint published last month. The "write error" seems like the input is not as expected.
Hope this helps you,
Best regards
I even tried in Azure runbook, I was getting the same error. We are using some content types based logic in the script,so according to Microsoft auto-syncing of content type will stop this month. So this is very critical .
Hi @Harikrishnan P
Since I could not search any documents to explain this issue, I suggest you could open a service request in Microsoft 365 admin center for better help.
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
I have raised a ticket with Microsoft. They said PnP is not an MS product, so they can't do the support for the same. It's interesting that MS only suggested using this command. Considering that its only 2 weeks left to stop the automatic synchronization, it's really frustrating.
This the code I'm currently using
$ctHubUrl = Get-PnPContentTypePublishingHubUrl
Connect-PnPOnline -Url $ctHubUrl
$CTIds = Get-PnPContentType
Write-Output 'Count:' $CTIds.Count
$list = New-Object Collections.Generic.List[string]
foreach($id in $CTIds)
{
$list.Add($id.Id.StringValue)
}
Add-PnPContentTypesFromContentTypeHub -ContentTypes $list -Connection $site
Start-Sleep -s 60
$SiteContnetTypes= Get-PnPContentType -InSiteHierarchy -Connection $site
Write-Output 'Count:' $CTIds.Count
After running this code I got the error 'The type of data at position 280 is different than the one expected.' But I confirmed that the count of content types in the hub and new site are the same using the above code.
To verify the same using the UI I checked the Content-type gallery (/_layouts/15/SiteAdmin.aspx#/contentTypes) of the new site, I can see that all content types are added but if check the classic UI (/_layouts/15/mngctype.aspx) custom content types are not appearing there.
Is this an expected behavior?
What I want to do is, I want to add a content type to the list using a site design script. Previously we were relying on 1-hour delay to sync the content types to the new site. Now we removed it and tried the above code, but the problem is site design is not adding the content type to the list. I also tried the command Add-PnPContentTypeToList, which is also not working.
This will work if we wait for 1 hour and the classic UI is populated with all the content types. Any idea on this issue?
Note: I also noticed that even if we don't run the above code, immediately after creating the site Content type gallery (/_layouts/15/SiteAdmin.aspx#/contentTypes) will have all the custom content types populated by default. Not sure if this be the case once MS turn off content type sync in feb.