Forum Discussion
Error:Microsoft.SharePoint.Client.ServerException: Argument SiteUrl must be a tenant administration
Sayan DuttaMajumdar can you post your powershell?
- Sayan DuttaMajumdarMar 06, 2017Copper Contributor
Hi- I have run below 2 Powershell command:
Script1:
cls
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)
{
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
$url ="https://SSSSSSSSSSSSSSSSSSSSSS"Write-Host "Setting $url as tenant site ..." -ForegroundColor Yellow
$site = get-spsite -Identity $url
$site.AdministrationSiteType = [Microsoft.SharePoint.SPAdministrationSiteType]::TenantAdministration
Write-Host "$url set as tenant site!" -ForegroundColor GreenScript2:
Set-SPSiteAdministration "https:/sssssss" -AdministrationSiteType TenantAdministration
IISRESET
- Mar 06, 2017
This script isn't using the PnP PowerrShell options available.
Please look here: https://github.com/SharePoint/PnP-PowerShell/blob/master/Documentation/readme.md
You are looking for the New-PnPTenantSite Cmdlet.
https://github.com/SharePoint/PnP-PowerShell/blob/master/Documentation/NewPnPTenantSite.md
- Sayan DuttaMajumdarMar 06, 2017Copper Contributor
Hi: Since I am using on Premises: Below 2 PS commands I have used.
Script1:
#
# Enable the remote site collection creation for on-prem in web application level
# If this is not done, unknon object exception is raised by the CSOM code
#
$WebApplicationUrl = http://dev.contoso.com$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null)
{Write-Host "Loading SharePoint Powershell Snapin"
Add-PSSnapin "Microsoft.SharePoint.Powershell"}
$webapp=Get-SPWebApplication $WebApplicationUrl$newProxyLibrary = New-Object "Microsoft.SharePoint.Administration.SPClientCallableProxyLibrary"
$newProxyLibrary.AssemblyName = "Microsoft.Online.SharePoint.Dedicated.TenantAdmin.ServerStub, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
$newProxyLibrary.SupportAppAuthentication = $true$webapp.ClientCallableSettings.ProxyLibraries.Add($newProxyLibrary)$webapp.Update()Write-Host "Successfully added TenantAdmin ServerStub to ClientCallableProxyLibrary."
# Reset the memory of the web applicationWrite-Host "IISReset..."
Restart-Service W3SVC,WAS -force
Write-Host "IISReset complete on this server, remember other servers in farm as well."
Script2:
#
# Set admin site type property to the site collection using PS for any site collection type.
# This is needed to be set for the site collection which is used as the
# "Connection point" for the CSOM when site collections are created in on-prem
#
$siteColUrl = http://dev.contoso.com$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null)
{Write-Host "Loading SharePoint Powershell Snapin"
Add-PSSnapin "Microsoft.SharePoint.Powershell"}
$site = get-spsite -Identity $siteColUrl
$site.AdministrationSiteType = [Microsoft.SharePoint.SPAdministrationSiteType]::TenantAdministration
Still getting error after running the batch file..
[Error] Error during stage "SiteCreation" siteprovisioning: "https://SSSS"
Microsoft.SharePoint.Client.ServerException: Argument SiteUrl must be a tenant administration site.