views:

28

answers:

2

After deploying an upgrade to a particular feature which contains ghostable page template, the page starts returning a 404 response.

In the SharePoint log, I get the following

Cannot get ghost document: Features\FeatureName\SubFolder\PageName.aspx

Unknown SPRequest error occurred. More information: 0x80070002

I am able to get the page working by going through SharePoint Designer and deleting the file, then deactivating/activating the feature on that site.

I've attempted resetting the web to its definition with no change.

I would like to have a programmatic solution, whether it be fixing something in the feature's configuration or an update program.

A: 

Is it possible that the upgrade deleted the file from the file system? cause this is the likely reason. go to the feature folder and see if the file is still there. the feature folder would be under template\features under 12/14 (depending on SP version)

Vladi Gubler
A: 

I was able to work-around the problem by

  1. Adding a snip of code to the feature deactivating event to delete the file in question from SitePages.

        SPFolder sitePagesFolder = web.GetFolder("SitePages");
        foreach (SPFile file in sitePagesFolder.Files)
          if (file.Name == "pagename.aspx")
            file.Delete();
    
  2. And using a utility, go through all the affected webs, re-activating the feature in question, which causes the 'orphaned or whatever' file to be removed, replacing it with the current version's

I don't understand the inner workings of the issue completely, but it seems that when the feature is deleted/reinstalled, sometimes the associated, ghosted file is orphaned, leading to this issue.

Greg Ogle