Freigeben über


How to find a SharePoint Desinger’s designed page?

By default SharePoint pages are ghosted pages, store their content in the content database but for the look & feel  and layouts they referred to file system pages ( master pages, css, user controls etc..).If you modify any page in SharePoint Designer then if will become un-ghosted pages. All the data related to this page will get stored in the database. Any modification you do to the look and feel of this page will not be affected on the complete site.

 

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;

namespace GhostFinder
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args == null || args.Length < 1)
            {
                PrintUsage();
                return;
            }

            bool hasUrl = false;
            string url = null;
            for (int i = 0; i < args.Length; i++)
            {
                if (args[i] == "-url" && i + 1 < args.Length)
                {
                    url = args[i + 1];
                    hasUrl = true;
                }
            }

            if (!hasUrl)
            {
                PrintUsage();
                return;
            }

            using (SPSite site = new SPSite(url))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    SPFile file = web.GetFile(url);
                    if (file == null)
                    {
                        Console.WriteLine(string.Format("File '{0}' not found.", url), url);
                    }
                    else
                    {
                        SPCustomizedPageStatus page = file.CustomizedPageStatus;
                        Console.WriteLine("Status : " + page.ToString());
                    }
                }

            }
        }

        private static void PrintUsage()
        {
            Console.WriteLine(@"This is command line tool.");
            Console.WriteLine(@"Usage: To know customized page status, please provide the full page address i.e : -url [https://navdeepm1/sites/TeamSite/default.aspx]");
        }
    }
}