代码改变世界

SharePoint - Another Way to Delete Site Collection

  努力学习的小熊  阅读(463)  评论(0编辑  收藏  举报

 

I had created a site collection. But there is a problem of web-frontend server (I did not know when I created the site), so the page is always in processing. After waiting 40 mins, I closed the page. When the problem of web-frontend server solved, I found the site link already existed, but I cannot connect to site and I cannot delete it in Central Administration.

Try to delete site collection in Application Management, failed
I select my site collection in Central Administration. For example, if I navigate to Application Management > View all site collections> selecte site collection, there is no information on the right side. No database, no adminitrator, nothing.

Use PowerShell to delete site collection, failed
Remove-SPSite -Identity http://domain/sites/sitename"

Nothing change

The Central Administration displayed the site in the sites list, but without any reference to the Content Database where it should have been created. No way to remove it using the web interface (all pages displaying information about the site had no content at all).

Then i thought to clean it up and remove via script.

A simple Get-SPSite returned a valid object. But a subsequent Remove-SPSite failed with the dreaded “Unknown SPRequest error.occurred”.

I had to find a quick solution, like a “force delete” when the site cannot be deleted.

Therefore I used a not so well-known operation on the Content Database object: Microsoft.SharePoint.Administration.SPContentDatabase::ForceDeleteSite (see http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spcontentdatabase.forcedeletesite.aspx).

With this simple PowerShell code I managed to work it out and clean the unwanted or corrupted site.

$site = Get-SPSite http://siteurl
$siteId = $site.Id
$siteDatabase = $site.ContentDatabase 
$siteDatabase.ForceDeleteSite($siteId, $false, $false)

As the Information clearly states in the image As the Information clearly states in the image

 

Reference: https://sharepoint.stackexchange.com/questions/133131/cannot-delete-site-collection-in-central-administration

 

编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
历史上的今天:
2009-06-05 SharePoint 2007在仅有内容数据库的灾难性恢复
2009-06-05 SharePoint 错误0x80040E14解决(续)
2006-06-05 使用配制文件定制身份验证和基于角色的安全
点击右上角即可分享
微信分享提示