Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand

Archive for February, 2013

Squadron – Explorer Add-in

Posted by JP on February 26, 2013

In this article I would like to introduce you to the Explorer (Old Site-Structure) Add-in of Squadron.

What are the advantages of Explorer?

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

image

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

clip_image004

Squadron is a Free SharePoint 2010 Productivity tool deployed using ClickOnce technology. You can install it from 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.

clip_image006

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

clip_image008

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

clip_image010

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

clip_image012

Following is the result after generating Items & Versions.

clip_image014

Please note that the versions are displayed within Parenthesis.

Grid Style

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

clip_image016

Now click the Execute button again.

clip_image018

Export to Excel

For saving the rows, right click & choose:

1. Export to Excel

2. Export to CSV

clip_image020

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

CSV option is also good but if you have COMMA (,) character in the names of Site, List, 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.

clip_image022

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 get displayed in the right side.

clip_image024


 

Code Behind

Following is the code to generate the Hierarchy information.

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, 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 Root Web of a site, 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 helpful tool in your bag while visiting a new SharePoint customer.

You can download & use Squadron for Free, if you face any installation problems, please let me know.

Advertisements

Posted in C# | 7 Comments »

SharePoint 2010 Topology Determination

Posted by JP on February 23, 2013

In this post we can explore an Architect Track topic.  

SharePoint Topology

SharePoint Topology determines the number of servers in a SharePoint farm.

For example: SharePoint Farm consists of the following type of servers:

  1. Web Front Ends (WFE)
  2. Application Server
  3. Database Server

Other subdivisions of servers would be:

  1. Search Database Server
  2. Sandbox Code Execution Server
  3. Crawl & Administration Server

In the matter of Topology determination we can use the following PDF from Microsoft.

image

Link

Posted in C# | Leave a Comment »

InfoPath forms not printing Background colors within SharePoint

Posted by JP on February 15, 2013

Today i encountered a problem said by my customer.  He was not able to print the InfoPath form with background color.

image

While printing the background colors are turned off by the following settings:

  1. InfoPath
  2. Internet Explorer

 

Solution

There are multiple areas for us to make it enabled.  I am listing all the potential areas you might need.

You can enable it through InfoPath Designer in File > Options menu:

image

In the browser side choose the Tools > Internet Options > Advanced (tab) > Printing (section)

image 

There is one more are you need to enable it.  It is the Print Preview Settings.

Choose the Browser > Print > Print Preview > Settings

image

In the appearing dialog click on settings button.

image

There you are, now you can see the Print Preview dialog itself having Color Background.

Posted in C# | Leave a Comment »

What is SharePoint SKU?

Posted by JP on February 15, 2013

In this short article I would try to reveal the meaning of SharePoint SKU?

What is SKU?

The expansion of SKU is Stock Keeping Unit and it represents variations of the same product.

For example SharePoint 2010 has the following variations:

  1. Foundation
  2. Standard
  3. Enterprise

Plus there are trials too. 

The SKU can be determined through the registry key in the installation machine.  Following are different SKU variations of SharePoint 2010.

image

When the knowledge is Important?

While working with customer locations, you might need to know the variation of SharePoint installed.  This will allow you to understand the underlying features available.

How to find the SKU?

You can run the following code to find the SKU.

public class SKUFinder
{
    internal static Hashtable _products;

    public static Hashtable SharePointProducts
    {
        get
        {
            if (_products == null)
            {
                _products = new Hashtable();

                _products.Add("BEED1F75-C398-4447-AEF1-E66E1F0DF91E", "SharePoint Foundation 2010");
                _products.Add("1328E89E-7EC8-4F7E-809E-7E945796E511", "Search Server Express 2010");

                _products.Add("B2C0B444-3914-4ACB-A0B8-7CF50A8F7AA0", "SharePoint Server 2010 Standard Trial");
                _products.Add("3FDFBCC8-B3E4-4482-91FA-122C6432805C", "SharePoint Server 2010 Standard");
                _products.Add("88BED06D-8C6B-4E62-AB01-546D6005FE97", "SharePoint Server 2010 Enterprise Trial");
                _products.Add("D5595F62-449B-4061-B0B2-0CBAD410BB51", "SharePoint Server 2010 Enterprise");

                _products.Add("BC4C1C97-9013-4033-A0DD-9DC9E6D6C887", "Search Server 2010 Trial");
                _products.Add("08460AA2-A176-442C-BDCA-26928704D80B", "Search Server 2010");

                _products.Add("84902853-59F6-4B20-BC7C-DE4F419FEFAD", "Project Server 2010 Trial");
                _products.Add("ED21638F-97FF-4A65-AD9B-6889B93065E2", "Project Server 2010");

                _products.Add("926E4E17-087B-47D1-8BD7-91A394BC6196", "Office Web Companions 2010");
            }

            return _products;
        }
    }

    private const String SharePointProductsRegistryPath = @"SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\WSS\InstalledProducts\";

    public static string Execute()
    {
        string result = "Unknown";
        try
        {
            //Open the registry key in read-only mode.
            using (RegistryKey key = Registry.LocalMachine.OpenSubKey(SharePointProductsRegistryPath, false))
            {
                //Get all of the installed product code/SKUId pairs.
                foreach (String value in key.GetValueNames())
                {
                    try
                    {
                        //Get the SKUId and see whether it is a known product.
                        String SKUId = key.GetValue(value) as String;

                        if (SharePointProducts[SKUId] != null)
                        {
                            result = string.Format("Product Installed: {0}", SharePointProducts[SKUId]);
                        }
                        else
                        {
                            result = string.Format("Unknown Product: {0}", SKUId);
                        }
                    }
                    catch (Exception e)
                    {
                        result = string.Format("Could not read key exception was {0}", e.Message);
                    }
                }
            }
        }
        catch (Exception e)
        {
            result = string.Format("Could not open key exception was {0}", e.Message);
        }

        return result;
    }
}

Need for Squadron

Squadron 2010 – Free SharePoint Tool has the SKU functionality integrated.  You need to just click on the SharePoint SKU add-in.

image

For installing Squadron, you can use the following URL:

http://www.sharepointact.com/Squadron2010/publish.htm

image

Note

Squadron is a ClickOnce technology enabled application which automatically updates itself with latest functionalities.  Additional to SKU there are other add-ins for analyzing site structure, permissions, list manipulations, workflow terminations etc.

References

http://msdn.microsoft.com/en-us/library/ff721969(v=office.14).aspx

http://en.wikipedia.org/wiki/SKU

Posted in C# | Leave a Comment »

Under Performance of Unique Permissions

Posted by JP on February 14, 2013

In this article we can explore the Performance Impact on Unique Permissions.

clip_image002

What is Unique Permission?

In SharePoint there are mainly 2 types of Permissions:

1. Inherited Permission

2. Unique Permissions

While creating a site, list or library by default it INHERITS permissions from its parent. In this case whatever permission changed in the parent level will get carry forwarded to the new child.

For example you have a COMMON site where all the employees have READ access. You are creating a new RESTRICTED library under this site, which by default all the employees can read.

In the above case you can BREAK inherited permission at the list level & add only those users with read permission. This method is called BREAKING PERMISSION or assigning UNIQUE PERMISSION.

Performance Impact

Coming to the point, I have noticed that there are rumors spreading unique permission lead to UNDER PERFORMANCE meaning there is more time in loading the list or list items associated.

Following are the 3 cases which we are going to examine here:

· List with Inherited Permission vs. List with Unique Permission

· List Items with Inherited Permission vs. List Items with SOME having Unique Permissions

· List Items with Inherited Permission vs. List Items with ALL having Unique Permissions

Let us BENCHMARK the performance with a 1000 item scenario.


 

Benchmark Application

I am using a small WPF application which creates the lists & list items associated. Please note that the Performance is tested only for accessing the list items.

clip_image004

The Code

Following is the code to create Lists.

private void CreateList(string title)

{

using (SPSite site = new SPSite(UrlText.Text))

{

using (SPWeb web = site.OpenWeb())

{

// Delete List

if (web.Lists.TryGetList(title) != null)

{

web.Lists[title].Delete();

}

// Create List

Guid guid1 = web.Lists.Add(title, string.Empty, SPListTemplateType.Contacts);

web.Lists[guid1].OnQuickLaunch = true;

web.Lists[guid1].Update();

SPList list = web.Lists[title];

// Insert new items

for (int i = 1; i <= 1000; i++)

{

SPListItem item = list.Items.Add();

item[“Title”] = “Title” + i;

item[“ZIP/Postal Code”] = i;

item.Update();

}

}

}

}

Following is the code that breaks the inheritance in list level.

private void BreakListInheritance(string title)

{

using (SPSite site = new SPSite(UrlText.Text))

{

using (SPWeb web = site.OpenWeb())

{

web.Lists[title].BreakRoleInheritance(true);

}

}

}

Following is the code that breaks inheritance in item level.

private void BreakListItemsInheritance(string title, int count)

{

using (SPSite site = new SPSite(UrlText.Text))

{

using (SPWeb web = site.OpenWeb())

{

SPList list = web.Lists[title];

for (int i = 0; i < count; i++)

{

list.Items[i].BreakRoleInheritance(true);

}

}

}

}

On running the application the Milli Seconds observed were following:

· Case 1 with both lists around 90 milliseconds

· Case 2 with both lists around 90 milliseconds

· Case 3 with both lists around 90 milliseconds

You can use the source code attached to examine the code & run the application.

 

The Conclusion

As we have tested with Breaking Inheritance in List level, Items level, All Items level and still cannot find any enormous difference in Performance for a typical 1000 items scenario.

Please note that breaking inheritance in item level up to 1000 items is a rare case.

clip_image002[1]

clip_image007

Whenever Unique Permissions are implemented there are more calls to the database in fetching Permission Information. But we can see that if there are only few items involved (for example less than 100), the performance impact is negligible.

References

http://bit.ly/10uiVpB

Summary

In this article we have explored various case studies involving Unique Permissions. The typical benchmark scenario shows that there is no much impact in performance in just breaking permissions.

Posted in C# | Leave a Comment »

Screen Shots of Project Lite

Posted by JP on February 13, 2013

This is a continuation article of the previous one – SharePoint 2010 Free Project Template which you refer for overview & installation of Project Lite. In this article we can see the various features of Project Lite template.

http://jeanpaulva.com/2013/02/10/sharepoint-2010-project-template-free/

After installation, we can create new Project Site from the Site Actions > New Site dialog.

image

Once creating new site, you will be getting the following site screen:

image

The Project Statement can be set through the left side link.

image

You can use the tab from main page to set the following:

1. Project Home

2. Project Schedule

3. Project Status

4. Project Configuration

image

Using the Project Schedule link we can manage tasks in Microsoft Project application style.

image

The Project Status page shows information on Tasks, Completion Percentage & Other symbols.

image 

The Project Configuration link can be used to change the Project Icon, Theme etc.

There is a document library for storing project related documents.

image

From the left hand side, you can launch the Project Wiki page.

image

Project Issues can be managed through the Project Issues link from Quick launch.

image

Project Members can be managed through the Site Permissions link. Each project member can:

1. View his/her task using My Work link

2. View all tasks using Work link

The links can be found in the Quick Launch as shown below:

image

So this concludes our overview on the Project Lite template.

References

http://bit.ly/XAusvW

Summary

This concludes our article on exploring Project Lite site template. In real world scenarios we can use each Project managed as separate sites of same Project Lite template.

The advanced template named Project Structured includes features like Scrum Support, Synchronization with MS Project application etc.

Posted in C# | Leave a Comment »

Moved Sites, Broken Links > Solution

Posted by JP on February 13, 2013

While we move SharePoint Sites to new locations, we face the following challenges:

  1. Broken Links in Site pages
  2. Broken Links in Documents
  3. Broken Links in Offline Bookmarks
  4. Broken Links in Custom Applications & Pingbacks

and more..

The immediate solution for Production environment would be:

  1. Use URL Redirection for old links
  2. Publish documentation of new links, so that users will start using new links
  3. After a period, search inside SharePoint using the old links, ensure no obsolete urls, stop redirection

Following is one Helpful Tool for the same purpose: RDA Collaboration Team Projects > SharePoint URL Redirector

http://rdacollaboration.codeplex.com/releases/view/28073

 

image

The tool seems to be working with SharePoint 2010.

Posted in C# | Leave a Comment »

Squadron 2010 – Now with ClickOnce!

Posted by JP on February 12, 2013

I am happy to deploy Squadron 2010 with ClickOnce enabled.  I believe this will reduce the deployment hassles as reported by community members.

image

Installation

You can install Squadron for SharePoint 2010 from the following url:

http://www.sharepointact.com/Squadron2010/publish.htm

image

Click on the Install button, download the file, execute it & you will be ready within few minutes.

There are shortcuts in the desktop too.

New Features

Following are the screen shots of new features integrated:

SQL – Copy Tables

image

Permissions

image

Permission Groups

image

Active Directory

image

Plus new theme in Blue (People did not liked the old red color :))

 

I will be adding tutorials for individual modules within a week.  Please bear with me & do not forget to send your feedback, I am always there to help you.

Have a good day ahead!

Posted in C# | Leave a Comment »

SharePoint 2010 Project Template – Free!

Posted by JP on February 10, 2013

In this article I would like to inform you on a Free Project Site Template available for SharePoint 2010. The template is useful in IT Software Development scenarios where each new project can be assigned a project management site. It provides convenience of:

· Setting Project Goals, Statements & Tasks

· Managing Tasks Assigned

· Dashboard on Project Status (Red, Yellow, Green)

· Microsoft Project integrated

SharePoint Project Template

SharePoint out of the box does not have a Professional Project Site Template. This requirement is is catered through various free project templates available in CodePlex.

Creating a new Project Site Template is a good idea provided the time & resource to develop it.

Which is the Free Project Template?

The project template we are discussing here is named Project Lite created by company named BrightWorks. You can download it from Microsoft PinPoint website.

image

http://pinpoint.microsoft.com/en-us/applications/free-sharepoint-project-management-templates-12884943482

image

There are 2 Project Types provided:

1. Project Lite

2. Project Structured

In this example I am showing the Project Lite site template.

image

Please note that you require Site Owner level permissions for installing this template & creating sites using it.

Installation

The installation was simple as it was a Sandboxed Solution. Just download the WSP files & you need to install in the Solutions Gallery.

Extract Zip File

image

Upload to Solutions Gallery

Choose Site Actions > Site Settings > Solutions > (Solutions Tab)

image

Click the Upload Solution and then click the Activate button

image

In the appearing dialog please click on the Activate button.

image

After activating you are ready with the template.

Create Project Site

Now choose, Site Actions > New Site > Free SharePoint Project Lite.

image

Enter the Title & URL information in the right pane, and click the Create button.

Waiting for a few minutes, you will get the following site ready.

image

References

http://pinpoint.microsoft.com/en-us/applications/free-sharepoint-project-management-templates-12884943482

Summary

In this article we have explored a SharePoint 2010 Project Template. To summarize with:

The project site provides the following features:

1. Project Statement Link which is Editable

2. Project Tasks list

3. Project Documents library

4. Calendar

5. My Work list which shows only current logged in user Tasks

6. Work list which contains all works to different project members

7. Microsoft Project Support

I believe this would be useful one & recommendable to customers. Additionally, there is a paid version of the template which provides much more features. Please ensure you read the licensing agreements before deploying to corporate environments.

Posted in C# | Leave a Comment »

Stopwatch – An Interesting Class in Diagnostics

Posted by JP on February 6, 2013

Do you know we have a Stopwatch class inside the System.Diagnostics namespace?

Yes! It helps in finding the elapsed time.

For example:

using System.Diagnostics;

 

Stopwatch watch1 = Stopwatch.StartNew();
DoSomeLengthyProcessHere();

watch1.Stop();

MessageBox.Show(watch1.Elapsed.TotalSeconds.ToString()); // Get the elapsed seconds

Posted in C# | 4 Comments »