Click here to Skip to main content
Click here to Skip to main content

Ghost un-ghosted SharePoint 2010 files

, 22 Dec 2012
Rate this:
Please Sign up or sign in to vote.
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 featur
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 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)

Share

About the Author

Adel Refaat
LINK Development
Egypt Egypt
No Biography provided
Follow on   Twitter   Google+

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web04 | 2.8.140827.1 | Last Updated 23 Dec 2012
Article Copyright 2012 by Adel Refaat
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid