Squadron Documentation Addin in SharePoint

Squadron Documentation

In this article we can explore the Documentation add-in of Squadron along with code.

What Documentation is

Documentation helps with documenting the SharePoint Farm and Application information.



Who the Target Audience is

This tool is targeted for Architects, Administrators and Developers.

A SharePoint Professional can use the tool to capture information about the Customer SharePoint Farm. You need to run this in the SharePoint Farm Server.

How to run the Documentation add-in

Open Squadron then choose "Documentation" from the left panel then select the required items then click the "Execute" button. You will get the results as shown below.

Documentation add-in

HTML Export

The tool provides HTML export of the results.

HTML Export

After fetching the results, you can click this button to create the HTML report.

HTML report
 
Service application
 
Farm Solutions 
 
Farm Solutions

After report generation, you can actually save the HTML file using a browser. By default the User’s Documents folder is the location of the generated file.

Code Behind

For those who are curious to know the code behind, please find it here.

Farm Servers code

private void Refresh_FarmServers()

{

    SPSecurity.RunWithElevatedPrivileges(delegate()

    {

        foreach (SPSolution s in SPFarm.Local.Solutions)

            list.Add(new SPFarmSolutionEntity(s));

    });

}

Services code

private void Refresh_Services()

{

    SPSecurity.RunWithElevatedPrivileges(delegate()

    {

        foreach (SPService s in SPFarm.Local.Services)

            list.Add(new SPServiceEntity(s));

    });

}

Service Applications code

private void Refresh_ServiceApplications()

{

    SPSecurity.RunWithElevatedPrivileges(delegate()

    {

        foreach (SPService s in SPFarm.Local.Services)

            foreach (SPServiceApplication sa in s.Applications)

                list.Add(new SPServiceApplicationEntity(sa));

    });

}

Content Databases code

private void Refresh_ContentDatabases()

{

    SPSecurity.RunWithElevatedPrivileges(delegate()

    {

        SPServiceCollection services = SPFarm.Local.Services;

               

        foreach (SPService service in services)

        {

            if (service is SPWebService)

            {

                SPWebService webservice = (SPWebService)service;

 

                foreach (SPWebApplication webapp in webservice.WebApplications)

                    foreach (SPContentDatabase cd in webapp.ContentDatabases)

                        list.Add(new SPContentDatabaseEntity(cd));

            }

        }

    });

}

Farm Solutions code

private void Refresh_FarmSolutions()

{

    SPSecurity.RunWithElevatedPrivileges(delegate()

    {

        foreach (SPSolution s in SPFarm.Local.Solutions)

            list.Add(new SPFarmSolutionEntity(s));

    });

}

User Solutions code

private void Refresh_UserSolutions()

{

    SPSecurity.RunWithElevatedPrivileges(delegate()

    {

        SPServiceCollection services = SPFarm.Local.Services;

 

        foreach (SPService service in services)

        {

            if (service is SPWebService)

            {

                SPWebService webservice = (SPWebService)service;

 

                foreach (SPWebApplication webapp in webservice.WebApplications)

                    foreach (SPSite sitec in webapp.Sites)

                        foreach (SPUserSolution s in sitec.Solutions)

                            list.Add(new SPUserSolutionEntity(s) };

            }

        }

 

    });

}

Managed Paths code

private void Refresh_ManagedPaths()

{

    SPSecurity.RunWithElevatedPrivileges(delegate()

    {

        SPServiceCollection services = SPFarm.Local.Services;

 

        foreach (SPService service in services)

        {

            if (service is SPWebService)

            {

                SPWebService webservice = (SPWebService)service;

 

                foreach (SPWebApplication webapp in webservice.WebApplications)

                    foreach (SPPrefix p in webapp.Prefixes)

                        list.Add(new SPManagedPathEntity(p) });

            }

        }

 

    });

}

Web Applications code

private void Refresh_WebApplications()

{

    SPSecurity.RunWithElevatedPrivileges(delegate()

    {

        SPServiceCollection services = SPFarm.Local.Services;

 

        foreach (SPService service in services)

        {

            if (service is SPWebService)

            {

                SPWebService webservice = (SPWebService)service;

 

                foreach (SPWebApplication webapp in webservice.WebApplications)

                    list.Add(new SPWebApplicationEntity(webapp));

            }

        }

    });

}

Site Collections code

private void Refresh_SiteCollections()

{

    SPSecurity.RunWithElevatedPrivileges(delegate()

    {

        SPServiceCollection services = SPFarm.Local.Services;

 

        foreach (SPService service in services)

        {

            if (service is SPWebService)

            {

                SPWebService webservice = (SPWebService)service;

 

                foreach (SPWebApplication webapp in webservice.WebApplications)

                {

                    foreach (SPSite sitec in webapp.Sites)

                        list.Add(new SPSiteEntity(sitec));

                }

            }

        }

    });

}

Sites code

private void Refresh_Sites()

{

    SPSecurity.RunWithElevatedPrivileges(delegate()

    {

        SPServiceCollection services = SPFarm.Local.Services;

 

        foreach (SPService service in services)

        {

            if (service is SPWebService)

            {

                SPWebService webservice = (SPWebService)service;

 

                foreach (SPWebApplication webapp in webservice.WebApplications)

                    foreach (SPSite sitec in webapp.Sites)

                    {

                        foreach (SPWeb web in sitec.AllWebs)

                            list.Add(new SPWebEntity(web));

                    }

            }

        }

    });

}

Lists code

private void Refresh_Lists()

{

    SPSecurity.RunWithElevatedPrivileges(delegate()

    {

        SPServiceCollection services = SPFarm.Local.Services;

 

        foreach (SPService service in services)

        {

            if (service is SPWebService)

            {

                SPWebService webservice = (SPWebService)service;

 

                foreach (SPWebApplication webapp in webservice.WebApplications)

                    foreach (SPSite sitec in webapp.Sites)

                        foreach (SPWeb web in sitec.AllWebs)

                        {

                            foreach (SPList l in web.Lists)

                                list.Add(new SPListEntity(l));

                        }

            }

        }

    });

}

Items code

private void Refresh_Items()

{

    SPSecurity.RunWithElevatedPrivileges(delegate()

    {

        SPServiceCollection services = SPFarm.Local.Services;

 

        foreach (SPService service in services)

        {

            if (service is SPWebService)

            {

                SPWebService webservice = (SPWebService)service;

                foreach (SPWebApplication webapp in webservice.WebApplications)

                    foreach (SPSite sitec in webapp.Sites)

                        foreach (SPWeb web in sitec.AllWebs)

                            foreach (SPList l in web.Lists)

                            {

                                foreach (SPListItem item in l.Items)

                                    list.Add(new SPItemEntity(item));

                            }

            }

        }

    });

}

Note

The information fetch is purely read-only using the Server Object Model. There are no- write operations for this add-in.

operations for this add-in

If you wanted some more items or fields to be included in the Documentation then please let me know. I am happy to provide it. (I am even ready to create the SharePoint 2013 version of tool on demand.)

About Items

The last item "Items" will be fetching List items / Library documents information. This will be very-time consuming depending on the size of the farm. By default it is kept unselected.

What Squadron is

Squadron is a Free SharePoint Administration tool available at sharepointcto.
 
Squadron

How to download Squadron

Squadron for SharePoint 2010 can be downloaded from the link below:

Dwnload Squadron for SharePoint 2010

Squadron is built on Click Once deployment, so installation is simple and automatic updates are possible.
 
update Squadron

References

Squadron for SharePoint 2010

Summary

In this article we have explored the Documentation addin of Squadron. I hope this will be helpful for you in real-world scenarios.