Generating report on items customized with UI/SPD

While managing SharePoint sites (2010/2013) you may want to gather details of items that have been customized directly via UI/SPD after being deployed via WSP. If you have sites with hundreds of items getting deployed via WSP on various libraries in SharePoint then it can quickly become governance nightmare when site owners (or other users with permission) modify these files directly on the site. Problem become more severe if you follow DEV->TEST->UAT->PROD deployed scheme (or similar) where you deploy your coding artifacts using WSP to SharePoint in each of these environment. Also you may want to narrow down your focus while reporting these customizations to specific library/list depending on your situation.

I put together a table below that shows what details are captured by the report. The report is generated using a PS script and target single library at each run so you can target different library every time as per your need. For administrators you can automate the script execution periodically using Windows Tasks Scheduler. I choose XML as output format because it provides greater flexibility to consume it later using tool of your choice (e.g. Excel, Word, XSLT etc.).

The formatting on this blog can be tricky so I would recommend you to download following files here and open the output file (Report-Sample.xml) in editor of your choice.

  1. ReportAllCutomizedItemsInLibrary.ps1 – This is actual script that do all the work.

  2. Report-Sample.xml – This is a sample report output file which is generated when script is executed.

     

Item Details 

Example 

List/Library Details

Provides summary which includes following.

  • Parent Site Utl
  • List/Library ID
  • TotalPagesIncludingFolders
  • HasUniqueRoleAssignments
  • TotalCustomizedPages

 

<List

Title="Pages"

ParentSiteUrl=""

ParentWebUrl="/"

Id="780e917c-dc7d-4bf2-8dbe-a5cfaf87a3e5"

TotalPagesIncludingFolders="2"

HasUniqueRoleAssignments="False"

TotalCustomizedPages="1">

 

Item Details (customizations)

For every item that is customized following information is gathered

  • Title
  • ServerRelativeUrl
  • ContentType
  • HasUniqueRoleAssignments
  • Level
  • Moderation Information
  • ID
  • Versions (Total Version and cumulative size of all versions)
    • Version Number
    • Size
    • Level
    • Creation Date
    • Created By
    • Is Current Version

 

<Page Name="default.aspx">

<Title>Home</Title>

<ServerRelativeUrl>Pages/default.aspx</ServerRelativeUrl>

<ContentType>Welcome Page</ContentType>

<HasUniqueRoleAssignments>False</HasUniqueRoleAssignments>

<Level>Published</Level>

<ModerationInformation>N/A</ModerationInformation>

<UniqueId>00c39da2-e647-4a56-9361-a0afa9fe6046</UniqueId>

<ID>2</ID>

<Versions Count="1" TotalSize="1.12012 KB">

<Version VersionNumber="1.0" Size="1.12012 KB" Level="Published" CreatedBy="SHAREPOINT\system"

Created="10/24/2013 23:10:04" IsCurrentVersion="True" />

</Versions>

<Layout>BlankWebPartPage.aspx</Layout>

<DisconnectedFromLayout>False</DisconnectedFromLayout>

<StartDate>01/01/1900 00:00:00</StartDate>

<EndDate>01/01/2050 00:00:00</EndDate>

<Uri>https://www.consoto.com/Pages/default.aspx</Uri>

</Page>

 

The script is actually straight forward – following are the parameters that need to be passed.

Parameter  

Description

siteUrl

The fully qualified site URL. E.g. https://www.contoso.com/sites/home. This parameter is mandatory.  

webRelativeUrl

Server relative web URL. E.g "hr". For root web pass empty string .This parameter is mandatory.

libName

Name of library which will be probe for customizations. This parameter is mandatory.

displayException

This parameter is optional.  

 

Two files are generated as an output when you execute the script.

File Name

Description  

Report{GUID}.xml 

The report with details around customizations. The GUID is used to keep file name unique.

ReportAllCutomizedItemsInLibrary.log

Log file contains basic logging information. Log file get appended on subsequent runs See next section for more details.  

 

Running the Script

  1. Open a new PowerShell Console or you can launch SharePoint Management Console. Either way it works.

     

  2. Run the command as shown in the window below. Off course you need to use different parameter values depending on your SharePoint site.

The script will execute and depending on size and number of items it may take from few seconds or more. Finally you will have output on the console similar to following.

It will display total number of items that are analyzed. Followed by the total items found customized.

Output

The report file contains all items found customized along with details. The file naming is in the format of Report{GUID}. Basically GUID is used to give the report file a unique name.

Report{26cc7937-9ccb-47bc-b2b3-0e3f781dd63d}.xml

ReportAllCutomizedItemsInLibrary.log

This is the log file that capture date/time, script name, report file name and its path. This file will be appended each time when script is executed from the same location.

That's it. I tested this script both on SharePoint Server 2010 and 2013 and it worked as expected.