0

I getting error of missing dependencies on web parts at Central Admin. So I ran Test-ContentDatabase to find all the errors. Once found, I ran another script against my database to find where the missing web parts where. All went well.

The thing is most of the URLs I got don't existe/are not accessible. So I cant navigate and remove the web part of the page.

Is there another approach to delete the web part? I have found scripts online but they all delete straight from the database, which is not recommended.

Central Admin Errors:

[MissingWebPart] WebPart class [af6b32d9-0e85-924c-cce0-0cae895460f7] is referenced [5] times in the database [SP_PRD_Content], but is not installed on the current farm. Please install any feature/solution which contains this web part. One or more web parts are referenced in the database [SP_PRD_Content], but are not installed on the current farm. Please install any feature or solution which contains these web parts. [MissingWebPart] WebPart class [666ac2ae-b462-2c71-a04d-324ee783ba43] is referenced [58] times in the database [SP_PRD_Content], but is not installed on the current farm. Please install any feature/solution which contains this web part. One or more web parts are referenced in the database [SP_PRD_ContentL], but are not installed on the current farm. Please install any feature or solution which contains these web parts.

Update: I managed to find the page where the web part is, but when I navigate to the page's ?contents=1 there is no error web part. Theres actually no web parts displaying however, when I query the database I can find this web part related to the page. Do I need to do something to SharePoint realize I've already removed the web part?

  • Are you trying to delete a broken webpart on a specific page? – penleychan Sep 27 '17 at 20:22
  • Yes, this is case 1. But even after removing from ?contents=1, I still get error. Case 2: I'm trying to delete a webpart on a broken page. The page does not exist, yet health analyzer is displaying an error on it. – ranbo Sep 27 '17 at 20:24
  • so you can't navigate to it? If you can try appending ?Contents=1 query string to the url. – penleychan Sep 27 '17 at 20:27
  • I cant. Not even with the ?Contents=1 – ranbo Sep 27 '17 at 20:29
  • Is it possible to delete without navigating to it? :) – ranbo Sep 27 '17 at 20:51
0

Please find below the points to troubleshoot it.

  • Search with web part name/id in Features folder in 14 hive. If found, you can use Uninstall-SPFeature with Force flag in powershell to remove it. If you have the solution file then install it.
  • Install Feature Admin tool and locate the web part. You can remove it in the tool if found.
  • I couldn't find it in the folder 14. Its also not a feature, but a web part. – ranbo Sep 27 '17 at 19:04
  • When health analyzer displays a page that doesn't exist, it means it does exists in content database but can't be viewed in the browser due to number of reasons? Can you open that page in the browser and see the error in the ULS logs and update your question with the error? – Ahmad Zia Sep 28 '17 at 1:22
  • I get page not found(404) and nothing comes up in the ULS logs – ranbo Sep 28 '17 at 12:13
  • Could you check from the url if the page is coming from any library like pages? If yes, can you see that in powershell? – Ahmad Zia Sep 28 '17 at 13:25
  • They are not in libraries. They are on the root of web or site collection. – ranbo Sep 28 '17 at 13:54
0

Try something like this via powershell, modify it where necessary:

if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction 
SilentlyContinue) -eq $null )
{
    Add-PSSnapin Microsoft.SharePoint.PowerShell
}

$siteUrl = "http://SharePoint/sites/projects/testproject1"
$spWeb = Get-SPWeb $siteUrl -ErrorAction Stop

#Declare the absolute path to the SharePoint page
$pagePath = "/SitePages/Home.aspx"
$pageUrl = $siteUrl + $pagePath
write-host "Processing site: ", $siteUrl
write-host "Processing page: ", $pageUrl

#Initialise the Web part manager for the specified profile page.
$spWebPartManager = $spWeb.GetLimitedWebPartManager($pageUrl, 
[System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)

#List all the Webparts in the specified page
foreach ($webpart in $spWebPartManager.WebParts)
{
    write-host $siteUrl +": Existing Web part - " + $webpart.Title + " : " + $webpart.ID
    break;
}
#Remove the Share Documents Web part from that page
foreach ($webpart in ($spWebPartManager.WebParts | Where-Object {$_.Title -
eq "Shared Documents"}))
{
    write-host $siteUrl +": Existing Web part - " + $webpart.Title + " : " + $webpart.ID
    $webpart1 = $webpart
    break;
}
#Delete the existing webpart
$spWebPartManager.DeleteWebPart($spWebPartManager.WebParts[$webpart1.ID])
write-host "Deleted the existing Shared Document web part."

$spWeb.Dispose()

Source: http://surya20p.blogspot.ca/2012/11/remove-webpart-from-sharepoint-pages.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.