Click here to Skip to main content
15,885,278 members
Articles / Productivity Apps and Services / Sharepoint / SharePoint 2010

Ghost un-ghosted SharePoint 2010 Files

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
22 Dec 2012CPOL2 min read 12.4K   2  
Ghost un-ghosted SharePoint 2010 files

Recently, I faced some performance problems in a big customized SharePoint solution. One of the reasons was that some of the page layouts and master pages are un-ghosted by SharePoint designer users, and some other page layouts were created directly in the SharePoint designer without having a feature to deploy them.

I had to fix that up by re-ghosting the customized pages and create a ghosted version for the files that have been created inside the SharePoint designer without a deployment feature.

Assessing the current situation, I have the following cases:

Case 1: Some pages had been deployed using SharePoint features, but after that were edited in SharePoint designer. So, they are now customized (un-ghosted) SharePoint Designer displays the icon beside these files.

Case 2: Some pages had been deployed using SharePoint features, but after that, they were replaced in SharePoint designer by uploading another file with the same name and overwriting the existing one. So, they are now customized (un-ghosted) SharePoint Designer doesn't display anything to show that these file are customized.

Case 3: Some pages had been created directly by importing files to the SharePoint designer using import option, which means they have never been ghosted before. Again, SharePoint Designer doesn't display anything to show that these file are customized. (Actually, they are not customized because they have never been ghosted before) but I need to make them ghosted.

So, I created a Windows application small tool, SPGhostFilesManager, to help in doing the job.

First, I want to know what are the customized files (the three types above).

Second, I have to revert the un-ghosted files that already have ghosted files deployed, but after updating the ghosted files by the customized files content.

Third, I have to create ghosted files for the files created directly in the SharePoint designer and re-ghost those files to keep everything working as is while having all the files ghosted.

Here are the steps I followed to handle each of the above cases:

For Case 1:

For Case 2:

  • Using SPGhostFilesManager, save each file content to the disk using the "Save" button.
  • Back to the SharePoint feature in Visual Studio, update the content of the original deployable files.
  • Redeploy the feature containing the files to have the ghosted files updated.
  • Using SPGhostFilesManager, Click "Revert" button beside each file to revert it back to the ghosted file.

For Case 3: (These are the files with Status None on the SPGhostFilesManager view.)

  • Using SPGhostFilesManager, save each file content to the disk using the "Save" button.
  • Create a SharePoint feature (or use an existing one) to deploy these files as ghosted versions but you have to choose other names for the files to be able to link the old un-ghosted files to these new ghosted files.
  • Deploy the created feature to get your ghosted files in the SharePoint environment.
  • Using SPGhostFilesManager, Click "Ghost" button beside each file to ghost it to the corresponding one you deployed using the feature.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Australia Australia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --