{"id":4605,"date":"2025-12-10T11:12:25","date_gmt":"2025-12-10T10:12:25","guid":{"rendered":"https:\/\/www.lieben.nu\/liebensraum\/?p=4605"},"modified":"2026-01-16T10:10:55","modified_gmt":"2026-01-16T09:10:55","slug":"microsoft-office-server-directory-directoryobjectnotfoundexception","status":"publish","type":"post","link":"https:\/\/lieben.nu\/liebensraum\/2025\/12\/microsoft-office-server-directory-directoryobjectnotfoundexception\/","title":{"rendered":"Microsoft Office Server Directory DirectoryObject NotFound Exception"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Can&#8217;t delete a sharepoint site that used to have a group attached to it, but the group has long since been deleted?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Apparently, the sharepoint admin center is unable to handle this scenario, and just throws a &#8220;could not be deleted&#8221; error. Using fiddler the only extra info I could get was an underlying 500 Internal Server Error Microsoft.Office.Server.Directory.DirectoryObjectNotFoundException was thrown<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Obviously that directory object not found means the office 365 group. Fora seem to point to MS support for manual fixes, but since Microsoft Support has rarely been a pleasant experience for me I went over the PS module for SPO and found a MUCH faster fix, hope it also works for you!<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>start PowerShell 5 (don&#8217;t use a newer version until the module supports it)<\/li>\n\n\n\n<li>install-module Microsoft.Online.SharePoint.PowerShell -force -scope currentuser (unless you already have the module installed)<\/li>\n\n\n\n<li>import-module Microsoft.Online.SharePoint.PowerShell<\/li>\n\n\n\n<li>Set-SPOSite -Identity https:\/\/xxx.sharepoint.com\/sites\/xxx -ClearGroupId<\/li>\n\n\n\n<li>Remove-SPOSite -Identity https:\/\/xxx.sharepoint.com\/sites\/xxx -noWait<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Can&#8217;t delete a sharepoint site that used to have a group attached to it, but the group has long since been deleted? Apparently, the sharepoint admin center is unable to handle this scenario, and just throws a &#8220;could not be deleted&#8221; error. Using fiddler the only extra info I could get was an underlying 500 &hellip; <a href=\"https:\/\/lieben.nu\/liebensraum\/2025\/12\/microsoft-office-server-directory-directoryobjectnotfoundexception\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Microsoft Office Server Directory DirectoryObject NotFound Exception<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[39,44],"tags":[],"class_list":["post-4605","post","type-post","status-publish","format-standard","hentry","category-powershell","category-sharepoint-online"],"_links":{"self":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/4605","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/comments?post=4605"}],"version-history":[{"count":2,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/4605\/revisions"}],"predecessor-version":[{"id":4617,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/4605\/revisions\/4617"}],"wp:attachment":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/media?parent=4605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/categories?post=4605"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/tags?post=4605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}