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

Posts Tagged ‘delete’

How to Delete a Managed Path?

Posted by Jean Paul on July 14, 2013

Imagine that you created a wrong managed path.  How to delete it?

  1. We can delete using Central Administration
  2. We can delete using PowerShell
  3. We can delete using Server Object Model

In this post, I will show how to delete a managed path using Central Administration.

Open Central Administration

Open Central Administration & Open Manage Web Applications link as shown below:


In the appearing page, select the web application, click the Managed Paths button as shown below:


You will get the following dialog:


Select the path, then click the Delete selected paths link from the top.  Your link is deleted.

Click the OK button to close the dialog.


In this post, we have explored how to delete a managed path.

Posted in SharePoint, SharePoint 2010 | Tagged: , , , , | Leave a Comment »

Error : Unable to Delete Site : SharePoint 2010

Posted by Jean Paul on June 28, 2013

I was working on a site moving, but the operation failed due to site template mismatch.  I ended up with a half-created site.

I can access the site through URL, but unable to access the site settings to delete the site.


I tried PowerShell Remove-SPSite approach, but it says it cannot find the site with url.


I tried to examine the problem using Squadron.  Luckily i was able to see the site there.  Then the rest is easy – created on Delete command which recursively delete sites & sub sites under.  It worked like a charm with Squadron.


Here are the steps involved to delete a site collection/site/list/library using Squadron.

Install Squadron

You can download the latest from

Install the application & run it from Start Menu > Programs > Squadron


Open the Explorer plugin from the left pane.


Locate the site to be deleted


Click the Delete button


Confirm site deletion


Great! Your defective site should be deleted now.


Here we have explored a rare scenario of defective site & deletion of it using Squadron.  You can use the tool for site collection deletion, list/library deletion as well

Posted in SharePoint | Tagged: , , , , | Leave a Comment »


Posted by Jean Paul on September 30, 2012

In this article we can experiment with BCS by connecting to an external database. After completing this article you will be able to:

· View Database Table inside SharePoint

· Perform Add/Edit/Delete operations

Following are the activities involved.

1. Create database and table

2. Using SharePoint Designer create BCS External Content Type

3. Using SharePoint Designer create Add/Edit/Delete operations metadata

4. Using SharePoint Designer create Lists & Form

5. Using Central Administration set Permissions for external Content Type

1. Create database and table

Create a database and table named Customer with following fields:


Add some data into it:


2. Using SharePoint Designer create BCS External Content Type

Now we can create an External Content type using SharePoint Designer. Start the Designer application and open our SharePoint web site > External Content Types as shown below.


Click on the External Content Type button from the top side. In the appearing window change the Name and Display Name (click on the links) as shown below.


Now click on the External System link and you will get the following dialog.


Click on the Add Connection button and select SQL Server in the appearing dialog.


In the appearing connection details dialog, enter your server details.


Click the OK button and your server connection is ready.

3. Using SharePoint Designer create Add/Edit/Delete operations metadata

From the appearing tables list select the Customer table and right click to get the context menu. Use the Create All Operations menu item to get the Add/Edit/Delete operations wizard.


Click on the Finish button in the appearing wizard.


Click on the Save button from the top tool bar.


4. Using SharePoint Designer create Lists & Form

Now the operations are ready and we need to create the List Form and the associated Add/Edit/Delete forms inside SharePoint.


From the toolbar, click on the Create Lists & Form button as highlighted above. In the appearing dialog box enter the name for the List and click the OK button as shown below.


Wait for a while and your List page will be ready.


5. Using Central Administration set Permissions for external Content Type

Now you can try viewing the Customer Data list inside SharePoint.


On clicking the list, you will be seeing an “Access Denied by Business Data Connectivity” error message. To resolve this we need to set permission for the External Content Type.

Open the SharePoint Central Administration website. Click on Manage Service Applicatoins.


In the appearing page click on the Business Data Connectivity Services link as shown below:


In the appearing list, hover over the Customer Data item and click on the Set Permissions menu item as shown below.


You will get the following dialog.


Enter the user name, click the Add button and check all permissions. Click the OK button to close the wizard. (Make sure you are adding the username used to view SharePoint)

Now you are ready with the Permissions. Go back to the SharePoint > Customer Data list and you will be able to see the data as shown below.


Now you can try playing with the View/Edit/Delete features of the BCS list.



In this article we have seen how to create an External Content Type through Business Connectivity Services and view it inside SharePoint. In the real world scenario using BCS we can connect to WCF Services and other Business Applications like Microsoft CRM to view/update data inside SharePoint.

Posted in SharePoint | Tagged: , , , , , , , | 2 Comments »

Delete an Orphaned Workflow

Posted by Jean Paul on August 24, 2012

In this article we can explore a real world scenario where a workflow is sending reminder email to users and the interesting thing is that the task list & data no long exists.

I have encountered such scenarios multiple times in my consulting arena and I would recommend running the latest cumulative updates to resolve the issue. In cases where the update patching is not feasible you can use the following solution approach.

Understanding the Problem

To make sure the problem is being conveyed correctly I am using the following points:

1. Task List named Approval List was created

2. A new item was added to the Task List

3. An Approver is being notified on the task

4. The Task List was deleted, removed from Recycle Bin too

5. The notification mail is being sent every week

6. The user cannot modify the task or approve it to stop the emails

This case can arise due to an incomplete migration where the relational columns are mismatched. Our focus is to fix the problem so that our user is not being disturbed by obsolete or invalid emails.

Examining the Problem

As the first step you can try to impersonate as the user into the SharePoint web application. If you cannot access the user credentials you can try examining the SharePoint content database. The content database contains the list, list records, user, work flow information for a SharePoint web application.

You can get the content database name of the web application from Central Administration.


You can see the content database name from the appearing page. Ensure that you are referring to the right web application.


You can click on the Database Name link to see more information about like Server Name.


Now you can try logging in to the database using SQL Server Management. Following are our tables of interest. (Here we are examining List Workflows)




This table contains the list metadata like Title, Description etc.


This table contains the user data like list item.


This table contains the workflow instances.

Please note that there are no referential constraints but GUID values are used to interconnect between tables. Following are the table structures:


Note: Modification to the table using SQL / Direct Editing is restricted by Microsoft. You should use the Server Object Model for any modifications.

Proposed Solution

The advisable solution is to terminate the workflow using the SharePoint user interface.

To achieve this open Lists > Site Workflows link.


Click on the highlighted link as shown above. You should get the following Workflow Information page.


Click on the Terminate this workflow now link as shown above.

If the workflow gets terminated then you are good. Your customer should be happy as he will be free from the wrong email alert.

You can verify the database record to ensure the InternalStatus column is set to 8.


The enumeration for Internal State column mapping to SPWorkflowState is given below:


Extended Proposed Solution

This solution involves much more effort and advisable if the User or Administrator is not able to perform the above. You can write a piece of code to fetch the workflows under running state and cancel it using the Server Object Model.

Step 1: Create a new windows application

Create a new windows application and make the .Net version to 3.5, Platform Target to Any CPU. Add 1 TextBox, 2 Button and 1 ListBox as shown below:


Step 2: List the Workflow Instances

On the Find Running Workflow button click event invoke the following method which list all the Workflow Instances.

private void RefreshList()


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


using (SPWeb web = site.OpenWeb())



_internalList = new List<SPWorkflow>();

foreach (SPWorkflow workflow in web.Workflows)


List.Items.Add(workflow.AuthorUser.LoginName + " " + workflow.InternalState.ToString() + " " + workflow.Created.ToShortDateString() + " " + workflow.StatusUrl);






private IList<SPWorkflow> _internalList;

Note: Please note that periodically Workflow table is cleared of the completed workflows by a Timer Job.

Step 3: Terminate the Workflow

For terminating the Workflow use the following code.

private void TerminateButton_Click(object sender, EventArgs e)


if (List.SelectedIndex >= 0)


if (MessageBox.Show("Are you sure to Terminate this Workflow?", "Confirm", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)


SPWorkflow workflow = _internalList[List.SelectedIndex];



MessageBox.Show("Terminated.. The list will be refreshed after Timer Job removes the workflow entry!");




Note: Here we are using SPWorkflowManager class to terminate the workflow. The CancelWorkflow() is the method used to perform the same. After cancelling the item will be removed by a timer job.

Step 4: Execute the Application

On executing the application you can see all the workflows listed. Selecting the appropriate workflow and clicking the Terminate button should make the Workflow Internal State to Cancelled. From this point onwards the obsolete email problem will be stopped.


Note: Currently the workflow author, date and url information are added in the list. You are free to add additional information about the workflow in the list.



In this article we have explored a possible problem associated with obsolete task emails workflow and the solutions for it.

I would like to iterate that Microsoft recommended way of solution is to use the Server Object Model or Client Object Model to make the database changes rather than using SQL statements directly on the content database.

The source code for the article is attached.

Posted in SharePoint | Tagged: , , , | Leave a Comment »