.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Squadron - Site Structure Add-in: A SharePointTool

Posted By:Jean Paul       Posted Date: December 24, 2013    Points: 200    Category: SharePoint    URL: http://www.dotnetspark.com  

In this article we have explored the Site Structure Add-in in Squadron. I believe this would be a helpful tool in your bag while visiting a new SharePoint customer.
 

In this article I would like to introduce you to the "Squadron" Site Structure Add-in.

What are the advantages of Site Structure?

Using Site Structure we can quickly generate the Site Collection, Sub sites, Lists & Libraries and Items in a hierarchical manner. The information is useful in analyzing a site collection.

advantages-of-Site-Structure.jpg

We can also view in a Grid Style where the above objects are displayed in Rows with the facility to export too.

Squadron is a Free SharePoint 2010 Productivity tool deployed using ClickOnce technology. You can install it from the following location.
http://www.sharepointact.com/Squadron2010/publish.htm

How to generate the structure?

Install the Squadron application & execute it using the Desktop short cut. You will get the following screen.

generate-the-Structure.jpg

Now click on the left pane named Site Structure. You will get the following Site Structure screen.

generate-the-Structure1.jpg

Enter the Web Application URL in the URL textbox of the header. Click the Execute button to generate the site structure as shown below:

Execute-button-to-generate-the-site-structure.jpg

Please note that you can include Lists & Libraries by checking the Show Lists and Libraries checkbox. Additionally you can include Items & Versions using the Show Items and Show Version Count Checkboxes.

Image 1.jpg

The following is the result after generating Items & Versions.

Image 2.jpg

Please note that the versions are displayed within Parenthesis.

Grid Style

We can also generate a Grid Style using the Grid Style checkbox.

Image 3.jpg

Now click the Execute button again.

Image 4.jpg

Export to Excel

For saving the rows, right click & choose:

  1. Export to Excel
  2. Export to CSV

Image 5.jpg

After saving, the file is opened inside Microsoft Excel. You may uncheck the Open after the save option if you do not prefer automatic launching of the file after saving.

The CSV option is also good but if you have comma (,) characters in the names of Sites, Lists and Items; the generated file will be confusing.

Hidden Lists

The hidden lists checkbox allows you to include Hidden Lists in the result. Hidden Lists are those not displayed in the Quick Launch bar as well as the System Lists.

Image 6.jpg

Property Grid

We can examine each item properties further using the Property Grid. For example you wanted to view:

  • Allow Designer property of site collection
  • Allow Unsafe Updates property of site
  • Allow Deletion property of List & Library

You can view these properties by clicking the result item; the properties will be displayed in the right side.

Image 7.jpg

Code Behind

The following is the code to generate the Hierarchy information.

The following is the main method:

 

 

private void GenerateHierarchy(string url)
{
    tv.Nodes.Clear();
    SPWebApplication webApp = SPWebApplication.Lookup(new Uri(url));

    _rootNode = tv.Nodes.Add(webApp.Id.ToString(), GetDisplay(webApplication), 0, 0);
    _rootNode.Tag = webApplication;

    foreach (SPSite site in webApp.Sites)
    {
        if (FilterCheck.Checked)
            if (!site.Url.StartsWith(FilterText.Text))
                continue;

        TreeNode node = _rootNode.Nodes.Add(site.ID.ToString(), GetDisplay(site), 1, 1);
        node.Tag = site;
        node.ToolTipText = "Site Collection";

        IterateWebs(site, node);

        Application.DoEvents();
    }

    tv.ExpandAll();

    if (_rootNode != null)
        _rootNode.EnsureVisible();
}

For iterating webs, the following method is used:

private void IterateWebs(SPSite site, TreeNode parentNode)
{
    foreach (SPWeb web in site.AllWebs)
    {
        if (FilterCheck.Checked)
            if (!web.Url.StartsWith(FilterText.Text))
                continue;

        if (!web.IsRootWeb) parentNode = GetParent(web.ParentWebId.ToString());

        if (parentNode == null) parentNode = _rootNode;

        TreeNode node = parentNode.Nodes.Add(web.ID.ToString(), GetDisplay(web), 2, 2);
        node.Tag = web;
        node.ToolTipText = "Site";

        if (ShowListsChecked.Checked)
            IterateLists(web, node);
    }
}

For iterating Lists, the following is the method:

 

private void IterateLists(SPWeb web, TreeNode parentNode)
{
    foreach (SPList list in web.Lists)
    {
        if (list.Hidden || !list.OnQuickLaunch)
            if (!ShowHiddenChecked.Checked)
                continue;

        int imageIndex = 3;

        if (list is SPDocumentLibrary)
            imageIndex = 4;

        TreeNode node = parentNode.Nodes.Add(list.ID.ToString(), GetDisplay(list),
 imageIndex, imageIndex);
        node.Tag = list;

        if (list is SPDocumentLibrary)
            node.ToolTipText = "Library";

        else
            node.ToolTipText = "List";

        if (ShowItemsCheck.Checked)
            IterateItems(list, node);
    }
}



For iterating Items, use the following code:

 

private void IterateItems(SPList list, TreeNode parentNode)
{
    foreach (SPListItem item in list.Items)
    {
        TreeNode node = parentNode.Nodes.Add(item.ID.ToString(), GetDisplay(item), 5, 5);
        node.Tag = item;
    }
}


For finding the Root Web of a site, the following method is used:

 

 

private SPWeb GetRootWeb(SPWeb web)
{
    SPWeb result = web;

    while (result.ParentWeb != null)
        result = result.ParentWeb;

    return result;
}



References

http://bit.ly/XdwpRV 

Summary

In this article we have explored the Site Structure Add-in in Squadron. I believe this would be a useful tool in your bag while visiting a new SharePoint customer.

You can download & use Squadron for free, if you encounter any installation problems, please let me know.
v


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend