Share via


SPFile.CustomizedPageStatus property

Gets the customization (also known as "ghost") status of the file object.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public ReadOnly Property CustomizedPageStatus As SPCustomizedPageStatus
    Get
'Usage
Dim instance As SPFile
Dim value As SPCustomizedPageStatus

value = instance.CustomizedPageStatus
public SPCustomizedPageStatus CustomizedPageStatus { get; }

Property value

Type: Microsoft.SharePoint.SPCustomizedPageStatus
The customized status.

Examples

The following example shows how to discover the customized status of master pages for a Web site.

using System;
using Microsoft.SharePoint;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("https://localhost"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    SPList list = web.GetCatalog(SPListTemplateType.MasterPageCatalog);
                    if (list != null)
                    {
                        foreach (SPListItem item in list.Items)
                        {
                            if (item.File != null)
                            {
                                Console.WriteLine("Filename: {0, -20} Status: {1}",
                                    item.File.Name, item.File.CustomizedPageStatus);
                            }
                        }
                    }
                }
            }
            Console.Write("\nPress ENTER to continue....");
            Console.ReadLine();
        }
    }
}
Imports System
Imports Microsoft.SharePoint

Module ConsoleApp

    Sub Main()

        Using site As New SPSite("https://localhost")
            Using web As SPWeb = site.OpenWeb()

                Dim list As SPList = web.GetCatalog(SPListTemplateType.MasterPageCatalog)

                If list IsNot Nothing Then

                    For Each item As SPListItem In list.Items
                        If item.File IsNot Nothing Then
                            Console.WriteLine("Filename: {0, -20} Status: {1}", _
                                item.File.Name, item.File.CustomizedPageStatus)
                        End If
                    Next

                End If

            End Using
        End Using

        Console.Write(vbCrLf & "Press ENTER to continue....")
        Console.Read()
    End Sub

End Module

See also

Reference

SPFile class

SPFile members

Microsoft.SharePoint namespace