Skip to main content

Connect sharepoint management shell with site collection admin in 1 site only and remove content ty [Resolved]

how connect in sharepoint management shell of 1 site only without an access in https://org-admin.sharepoint.com, I have an site collection admin in 1 site of this sharepoint and i need to connect it in sharepoint management shell to remove content type under in _Hidden Group thanks.


Question Credit: Randy Prado
Question Reference
Asked July 11, 2019
Posted Under: Sharepoint
83 views
1 Answers

Yes, you could do that.

Demo PowerShell code for your reference:

$adminUPN="xxx@xxx.onmicrosoft.com"

$userCredential = Get-Credential -UserName $adminUPN -Message "xxx"

Connect-PnPOnline -Url https://xxx.sharepoint.com/sites/wendy -Credentials $userCredential

#Get content type from _Hidden group
Get-PnPContentType|? { $_.Group -eq '_Hidden' }
#remove "ContentType1" content type
Remove-PnPContentType -Identity "ContentType1" -Force

Get-PnPContentType|? { $_.Group -eq '_Hidden' }

Note: $adminUPN could be just the site collection administrator of site collection, in my test, it could work well.

Result: enter image description here enter image description here


credit: Kally_MSFT
Answered July 11, 2019
Your Answer