Just for my reference, or anyone else interested, a link to the perfect guide on creating a custom filter section in the refinement panel.
http://www.domorewithsearch.com/customizing-the-refinement-panel-for-sharepoint-2010-search/
Just for my reference, or anyone else interested, a link to the perfect guide on creating a custom filter section in the refinement panel.
http://www.domorewithsearch.com/customizing-the-refinement-panel-for-sharepoint-2010-search/
This is a nasty SharePoint bug which caused some trouble in one of the SharePoint Online environments I was working on.
I created a Site Template using the “Save site as template” feature of SharePoint. Now when I created a new site from the template it resulted in the web parts all mixed up in the Left web part zone. Remarkably it was only the Left zone, the others were keeping their correct web part sequence.
When I took a look in the Onet.xml of the Site Template the web parts were nicely divided into seperate AllUsersWebPart’s and having correct WebPartZoneId’s. And although the web parts were also mixed up in the XML, the WebPartOrder properties were set correctly, 1 for the first, 2 for the second and so on. I still tried to rearrange the XML so the web parts would also have the right sequence in the syntax, but with no success, the web parts were still mixed up.
The final thing to do was to create a Web Part Zone for each Web Part. I did this by opening the page in SharePoint Designer and edit in the Advanced Mode (button on the ribbon).
This way the order is hardcoded on the page. I admit, it’s not very neat, but it does the trick.
In an earlier post I’ve explained that it’s possible to use PowerShell for SharePoint Online. In this post I want to explain what the difficulties of SharePoint Online are and how we did manage to overcome that.
When you use the Client Object Model directly from PowerShell, it might seem to work, up to the point that you’re executing a query. Then you will receive a 403 – forbidden error.
Off course, when you don’t provide any credentials you will not get access. You could try to provide a username, password and domain programmatically, but you won’t find any way to authenticate. This is because the authentication method of SharePoint Online differs from the ones that Client Object Model supports.
The only thing we have to do is get an authenticated ClientContext and we’re ready to script. Fortunately, Microsoft has done all the hard work, because they have published a sample project for authentication with SharePoint Online.
We are going to pimp this project with our own code and make it possible to retrieve and use an authenticated ClientContext in PowerShell.
Go ahead, download sample project and open the ClaimsAuth solution file in Visual Studio. You will see that it also loads a project called Sp_Ctx; you can remove or just ignore it, we won’t use it.
Now, in the ClaimsAuth project add a new class called “SPOContext” and use the following code:
using System.Net;
using Microsoft.SharePoint.Client;
using MSDN.Samples.ClaimsAuth;
public class SPOContext : ClientContext
{
public SPOContext(string siteUrl) : base(siteUrl)
{
// this method gives a popup asking for credentials
CookieCollection cookies = ClaimClientContext.GetAuthenticatedCookies(siteUrl, 0, 0);
this.ExecutingWebRequest += delegate(object sender, WebRequestEventArgs e)
{
e.WebRequestExecutor.WebRequest.CookieContainer = new CookieContainer();
foreach (Cookie cookie in cookies)
{
e.WebRequestExecutor.WebRequest.CookieContainer.Add(cookie);
}
};
}
// need a plain Load method here, the base method is some
// kind of dynamic method which isn't supported in PowerShell.
public void Load(ClientObject objectToLoad)
{
base.Load(objectToLoad);
}
}
As you can see, we made an object that inherits from the ClientContext. The magic happens in the constructor; a pop-up will be shown where the user can login with his credentials. It then receives a few cookies which are stored and sent with each request. The cookies are the fairy dust in all of this, the cookies make it possible to authenticate with each request.
You also see a Load method. Why do we need this? The base class already has a Load method! Yes, but that method is some kind of dynamic method which isn’t supported in PowerShell. This custom Load method now acts as a wrapper for the real Load method.
This is it! Build the project and test the ClaimsAuth.dll according to my previous post.
Who said using PowerShell with SharePoint Online is impossible? Microsoft?
“Currently powershell cmdlet can only be used to manage exchange online. There is no SharePoint Online support nor is there powershell remoting.” – stackoverflow.com
“PowerShell is not available unless a dedicated version of SharePoint Online is purchased.” – community.office365.com
“SharePoint Online does not currently support Windows PowerShell” - community.office365.com
Let me show you it is actually possible and it’s not even that hard.
Download this file and extract the DLL to an easy location to reach from PowerShell. Because this assembly uses the Client Object Model you need to install the COM Redistributable as well.
These are the PowerShell commands to run:
You need to run PowerShell in single-threaded mode (the authentication requires it).
powershell -STA
Import the DLL.
[Reflection.Assembly]::LoadFile("D:\ClaimsAuth.dll")
Instantiate a new SPOContext providing your SharePoint Online site URL. (Don’t forget the https)
$spoContext = new-object SPOContext("https://jeffreypaarhuis.sharepoint.com")
Now, let’s test it:
$spoContext = new-object SPOContext("https://jeffreypaarhuis.sharepoint.com")
$web = $spoContext.Web
$spoContext.Load($web)
$spoContext.ExecuteQuery()
Write-Host $web.Title
As you already might understand, this solution is based on the SharePoint Client Object Model. This means that everything that’s possible with the COM is possible to script. This post explains how to work with Sites, Permissions, Documents, etc. with the COM. It is written in C# but it’s fairly easy to translate to PowerShell.
-------------------
Init spoContext
-------------------
powershell -sta
[Reflection.Assembly]::LoadFile("D:\ClaimsAuth.dll")
$spoContext = New-Object SPOContext("https://mysharepointonline.sharepoint.com")
-------------------
Print sitename
-------------------
$web = $spoContext.Web
$spoContext.Load($web)
$spoContext.ExecuteQuery()
$web.Title
-------------------
Add property to bag
-------------------
$web.AllProperties.FieldValues.Add("propA","Property A")
$spoContext.ExecuteQuery()
$web.AllProperties.Item("propA")
-------------------
Show features
-------------------
$site = $spoContext.Site
$spoContext.Load($site)
$spoContext.ExecuteQuery()
$features = $site.Features
$spoContext.Load($features)
$spoContext.ExecuteQuery()
$features
-------------------
Permissions stuff
-------------------
Function GetWeb
{
$ctx.ExecuteQuery()
Return $ctx.Web
}
Function GetList ($name)
{
$web = GetWeb
if ($web -ne $null)
{
$lists = $web.Lists
$ctx.Load($lists)
$ctx.ExecuteQuery()
$list = $lists | where {$_.Title -eq $name}
return $list
}
return $null
}
Function GetRole ($rType)
{
$web = GetWeb
if ($web -ne $null)
{
$roleDefs = $web.RoleDefinitions
$ctx.Load($roleDefs)
$ctx.ExecuteQuery()
$roleDef = $roleDefs | where {$_.RoleTypeKind -eq $rType}
return $roleDef
}
return $null
}
Function GetPrincipal ($name)
{
$web = GetWeb
if ($web -ne $null)
{
$principal = $web.EnsureUser($name)
$ctx.Load($principal)
$ctx.ExecuteQuery()
return $principal
}
return $null
}
Function GetGroup ($name)
{
$web = GetWeb
if ($web -ne $null)
{
$groups = $web.SiteGroups
$ctx.Load($groups)
$ctx.ExecuteQuery()
$group = $groups | where {$_.Title -eq $name}
return $group
}
return $null
}
Function GetDocumentLibrary ($name)
{
$web = GetWeb
if ($web -ne $null)
{
$docLibs = $web.Lists
$ctx.Load($docLibs)
$ctx.ExecuteQuery()
$docLib = $docLibs | where {$_.Title -eq $name}
return $docLib
}
return $null
}
$web = GetWeb
$web.BreakRoleInheritance($true, $false);
$principal = GetGroup "MyGroup"
$roleType = [Microsoft.SharePoint.Client.RoleType]"Contributor"
$role = GetRole $roleType
$collRdb = new-object Microsoft.SharePoint.Client.RoleDefinitionBindingCollection($ctx)
$collRdb.Add($role)
$collRoleAssign = $web.RoleAssignments
$collRoleAssign.Add($principal, $collRdb)
$ctx.ExecuteQuery()
$list = GetList "Shared Documents"
$list.BreakRoleInheritance($false, $false);
$roleType = [Microsoft.SharePoint.Client.RoleType]"Reader"
$role = GetRole $roleType
$collRdb = new-object Microsoft.SharePoint.Client.RoleDefinitionBindingCollection($ctx)
$collRdb.Add($role)
$collRoleAssign = $list.RoleAssignments
$collRoleAssign.Add($principal, $collRdb)
$ctx.ExecuteQuery()
You might see the following errors from time to time, which aren’t a big deal:
- “The requested site does not appear to have claims enabled or the Login Url has not been set.”.
Problem: This usually means that no session can be instantiated (SharePoint Online bug).
Solution: Navigate to your site in Internet Explorer, when your site doesn’t show, refresh it a few times until it shows, or go to https://portal.microsoftonline.com. When you get a login page, go back to your script.
- ”The remote name could not be resolved: ‘mysp.sharepoint.com’”
Problem: During scripting, the context timed out.
Solution: Re-instantiate the $spoContext object. When running a script in one go, this error shouldn’t pop because the Context will not prematurely expire.
How does it work under the hood? What’s in the DLL? What makes SharePoint Online so difficult?
In line with this one I’ve written a post that explains what the problem with SharePoint Online is and how to build your own DLL. Read it here.
UPDATE (11-7-2012):
Forgot to mention you need to install the COM Redistributable.
UPDATE (3-9-2012):
Added samples.
By default, it’s only possible to sort on relevance and modified date in the Core Results Web Part. And it also isn’t possible to give a sorting direction, it’s always descending.
Now a client wanted to show the last created discussions on the homepage of it’s SharePoint, off course sorted by creation date. Out of the box this isn’t possible, but luckily somebody else had the same problem and came with a neat solution: http://www.insidesharepoint.net/post/2011/02/16/Creating-a-sortable-CoreResultsWebPart-in-SharePoint-2010.aspx
I played around a bit with that code, but couldn’t get it to work. The most common error I got was Property doesn’t exist or is used in a manner inconsistent with schema settings.
At this time of writing my expertise in the SharePoint Search maze isn’t that great, but I read something about a Managed Metadata Properties in the blog post. After playing around with custom managed properties for a while I finally got it to work. The trick is to create a custom Managed Property with mappings to, in my case, Basic:15;ows_start_x0020_Date,Office:12;creationdate and do a full crawl. Important! Do not do an incremental crawl! That will definitely not work! I cracked my head on that one already!
And then it works!
These are the steps I took to work out my case, which is sorting Team Discussions by Creation Date.
First I created a scope named Discussions with a rule contentclass = STS_ListItem_DiscussionBoard.
Then I created a Managed Metadata Property named Created with a few mappings and settings like below.
Next thing to do is to start a full crawl. No incremental, that won’t work!
Now we can create our own Web Part. Create a new Visual Studio 2010 project, call it SortableCoreResultsWebPart. Add a reference to Microsoft.Office.Server.Search and add a new Web Part to the project, no Visual Web Part, just a regular. Name it SortableCoreResultsWebPart.
Open the SortableCoreResults.cs and overwrite the code with the following code.
public class SortableCoreResultsWebPart : CoreResultsWebPart
{
[Personalizable(PersonalizationScope.Shared)]
[WebBrowsable(true)]
[WebDescription("Sort by this managed property")]
[Category("MyProperties")]
public string OrderByProperty { get; set; }
[Personalizable(PersonalizationScope.Shared)]
[WebBrowsable(true)]
[WebDescription("Sort direction")]
[Category("MyProperties")]
public Microsoft.Office.Server.Search.Query.SortDirection SortDirection { get; set; }
/// <summary>
/// Override. First runs the base code, than collects the CoreResultsDatasource and
/// sets the SortOrder property.
/// </summary>
protected override void ConfigureDataSourceProperties()
{
// only do stuff when search results are visible
if (this.ShowSearchResults)
{
// run the base code
base.ConfigureDataSourceProperties();
try
{
// if OrderByProperty is not set, use default behaviour
if (!string.IsNullOrEmpty(OrderByProperty))
{
// get the datasource and change the sortorder
CoreResultsDatasource dataSource = this.DataSource as CoreResultsDatasource;
dataSource.SortOrder.Clear();
dataSource.SortOrder.Add(OrderByProperty, SortDirection);
}
}
catch (Exception)
{
// handle this error! and show a friendly error message
}
}
}
}
Don’t forget to add an using for Microsoft.Office.Server.Search.WebControls.
Run the thing and add the Web Part to the page. An error will pop up saying SrhdcNoKeywordException was unhandled, skip it by pressing F5 or clicking continue a couple of times.
Edit the Web Part, open the Location Properties and modify the scope to Discussions. Open Result Query Options and modify Fixed Keyword Query to contentclass:STS_ListItem_DiscussionBoard. Finally fill the OrderByProperty with Created and set a SortDirection.
Save and refresh the page. Watch your web part sort like Dustin Hoffman in Rain Man!
You ever wanted to show external data in SharePoint? Do Arabs fart in the desert? Does Apple charge 200 dollars extra for a different color macbook?
Of course you want to show external data in SharePoint. But it isn’t as easy as it seems to achieve this. There are a few methods and every methods has it’s pro’s and con’s.
According to Microsoft the best method, and every SharePoint guru will agree, is Business Connectivity Services. This method is great for creating a seamless connection between SharePoint and your external data. It however has the big disadvantage that BCS can only be used in conjuction with the external list, and external lists cannot have additional columns. This means that a calculated column needs to be custom developed in the BCS model, which in turn means that it needs to be compiled, tested, deployed, etc. And this is pretty stupid because SharePoint has calculated columns out of the box with a custom list. Now, I´ve tried to get that BCS data into a custom list, but with no success. So then I started looking for a way without BCS and use SQL Server Integration Services(SSIS) instead. After googling for a while I found exactly what I was looking for.
http://fsugeiger.blogspot.com/2010/01/synchronise-sql-table-with-sharepoint.html
This solution can synchronize a database with a custom list. It however is one-way, so customized data in the list doesn’t get back into the database. But because it’s a custom list we can use calculated and other additional columns.
Prerequisites for this SSIS solution.
You need to have SQL Server Standard or higher with Integration Services enabled and Business Intelligence Studio installed.
Then you need the following plugin for the SharePoint list source and destination.
http://msdn.microsoft.com/en-us/library/dd365137(v=sql.100).aspx
I know, Sharepoint 2007 is pretty old. However, this week a client wanted FBA for his WSS 3 environment, so no problemo for the Sharepoint pro. I haven’t done a FBA config for Sharepoint 2007 before, so I did a bit of googling and couldn’t find a very explaining article that covers the whole configuration. There were a few handy sites, including the MSDN, which helped me out getting what I needed.
Further on it will be explained in detail, but here is a summary already:
Install ASP.NET membership database
Run the tool aspnet_regsql.exe at C:WindowsMicrosoft.NETFrameworkv2.0.50727
Choose the option to configure SQL Server for application services.
Choose the name of the database server in the server field. Choose Windows authentication and type a database name in the Database dropdown field. In this case we creat a database with the name fbadb.
Click next and Finish to complete the creation of the membership database.
Set the right SQL permissions
Because we wan´t to use integrated security with the connection we need to give the application pool identity the appropriate permissions on the membership database. First of all we need to know what the application pool identity is. For that you can go to the IIS Manager and select the Sharepoint site.
Click Advanced Settings… and note the Application Pool
Then click on Application Pools and select the noted application pool
Click Advanced Settings … and note the identity, in our case this is the Network Service
Now, go to SQL management studio and give that user the db_owner permissions on the FBA database we just created.
Extended web application with zone internet
Open Central Administration. Go to Create or extend web application in Application Management and click Extend an existing web application. In web application select the web application you wish to create FBA for.
However we are extending a web application, we need to create a new IIS web site so leave that option on.
I want to create a subsite for the FBA authentication, so I did set the port back to port 80 and set the host header to extranet.mydomain.com
Allow anonymous authentication and here you can also choose to use SSL or not. I choose not to use SSL. The last thing to do is to set the zone to Internet.
You can go to the url of the extended web application to check if the configuration works.
Last thing to do is to enable FBA on the extended web application. Go back to Central Administration and then click Authentication providers under Application Security. Then click on the Internet zone.
In this screen select the Forms authentication type. Two new fields appear: Membership provider name and Role manager name. This are the names of the membership and role provider we are going to configure in the next step. I’m using FBA for Membership provider name and FBARole for the role manager name.
Click Save and all central admin settings are set.
Edit web.config of the default web application and the extended web application
Next thing to do is to add a few items to the web.config of the web application and the extended web application:
Go to the web.config of the web application (not the extended web application) and search for the </sharepoint> closing tag and the <system.web> starting tag; they should be next to eachother.
Just above </SharePoint> you find the following piece of code:
<PeoplePickerWildcards> <clear /> <add key="AspNetSqlMembershipProvider" value="%" /> </PeoplePickerWildcards> replace this with the next code: <PeoplePickerWildcards> <clear /> <add key="AspNetSqlMembershipProvider" value="%" /> <add key="FBA" value="%" /> </PeoplePickerWildcards>
Now add a new ConnectionString section between the </sharepoint> and <system.web> tags:
<connectionStrings> <add name="fbaSQL" connectionString="server=localhost;database=fbadb;Trusted_Connection=true" /> </connectionStrings>
Because I run the database and Sharepoint on the same server I’m using localhost. If you are using a different database server you need to replace localhost with the database server name or ip here, pretty obvious.
Last thing to do is to add a membership and role section in the <system.web> tag. Add the following piece of code just below <system.web> and above <securityPolicy>:
<membership defaultProvider="FBA">
<providers>
<add connectionStringName="fbaSQL" applicationName="/" name="FBA" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="true"
minRequiredPasswordLength="5"
minRequiredNonalphanumericCharacters="0"
passwordFormat="Hashed" />
</providers>
</membership>
<roleManager enabled="true" defaultProvider="FBARole">
<providers>
<add connectionStringName="fbaSQL" applicationName="/" name="FBARole" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</providers>
</roleManager>
This web.config is done. Now do the same for the web.config of the extended web application.
Install http://fba.codeplex.com/ wsp
Download FBAManagement.wsp and Deploy.cmd from http://fba.codeplex.com/releases/view/2986 and save both files into the same folder. We need to edit some values in the Deploy.cmd so once downloaded go to the folder and rightclick Deploy.cmd and click edit. Now replace both http://aspnet with http://<yoursharepointsite>. Also remove the bin from “stsadm -o addsolution -filename binFBAManagement.wsp” so it reads only “stsadm -o addsolution -filename FBAManagement.wsp”. The code should look like this:
@echo Deploying FBAManagement solution @set PATH=C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN;%PATH% stsadm -o deactivatefeature -name FBAUserRoleManagement -url http://mysharepoint -force stsadm -o deactivatefeature -name FBAConfigurationManagement -force stsadm -o retractsolution -name FBAManagement.wsp -immediate stsadm -o execadmsvcjobs stsadm -o deletesolution -name FBAManagement.wsp -override stsadm -o execadmsvcjobs stsadm -o addsolution -filename FBAManagement.wsp stsadm -o execadmsvcjobs stsadm -o deploysolution -name FBAManagement.wsp -immediate -allowgacdeployment stsadm -o execadmsvcjobs stsadm -o activatefeature -name FBAConfigurationManagement stsadm -o activatefeature -name FBAUserRoleManagement -url http://mysharepoint stsadm -o execadmsvcjobs
Save the file and execute it as administrator. Don’t be scared with the file not found and solution not found messages for the first few lines, because thats entirely normal.
Result
All configuration is done. Go to the site settings of the sitecollection. Under site collection administration you find two new links. With Manage FBA Users you can add and edit users and with Manage FBA Roles you can add and edit roles, which is pretty straightforward.
To test FBA you can add a user and give the user some permissions by adding it to the Team Site Members group. Now, login with the user on the extended web application and see the result.
I have done a few years of sharepoint developing now. When I began to write small webparts in Sharepoint I was very enthusiastic about the features of the Sharepoint framework and thought it was as easy and solid as writing ASP.NET. Now I know better, developing Sharepoint masterpages, webparts, workflows, etc. is not all beer and skitties. Also when you haven’t encountered any troubles yet, you will get to it! So don’t waste your effort on developing the wrong way.
Here are some points of what I consider “Sharepoint 2007 developing and designing: Best practices”
Developing
Designing (Master pages)
These are the important points that have been in my head for a while, finally they got stored in HTML and are they readable for others. Did I miss something or do you have any tips yourself? I ‘ll be glad to know.
I was so lucky = to receive this error. It may be a bug in Sharepoint (Designer) or I may be the only one that has this problem. I hope you don’t have this “bug”, for them who have the same problem, here is the solution:
I was working on another custom page of EditForm.aspx, I have a DataForm Webpart on the page showing me the data the way I want it. On that Dataview I have a few text fields and also a Yes/No field. I wanted the user to only see this yes/no field and not edit it.
So I go to the page with Sharepoint designer and select the field and in the properties setting the attribute ControlMode from “Edit” to “Display”. This worked fine in SPD but when I did go to the EditForm in Sharepoint I was getting the following error “An unexpected error has occurred”. There was not much else I could change or try to resolve this. There isn’t just a property or value that needs to be set to get this working.
The ONLY way to make the page display the way you want in Sharepoint is the next one:
Go to the page in sharepoint designer, the current state of the field isn’t important. Click on the Yes/No field in the design view. Click on the arrow next to the selected field and change format to Boolean. You now see a Yes or No on the page. When you are in split view you can see a <xsl: when … /xsl:otherwise>. In this code you can change the black Yes and No between the tags to a yes and no in your preferred language. In my case that would make Yes -> Ja and No -> Nee.
The code will look like this:
<xsl:choose>
<xsl:when test="@YesNoField='1' or msxsl:string-compare(string(@YesNoField),'Yes','','i')=0 or msxsl:string-compare(string(@YesNoField),'True','','i')=0">Ja</xsl:when>
<xsl:otherwise>Nee</xsl:otherwise>
</xsl:choose>
Save, go to Sharepoint and enjoy your working form.
What I wanted to do is adding a delete button to each item in the listview to delete a record directly from the overview. Sharepoint has an edit button that can be inserted by adding the “Edit” column in the view editor. It’s a shame that Sharepoint doesn’t have a similar option for deleting. This doesn’t mean it is impossible, it’s just not that easy, here you go:
Open SPD(Sharepoint Designer) and go to the list you want to add the button to and open the AllItems.aspx
duplicate the ListViewWebPart by copying the following code and pasting it directly after itself.
<WebPartPages:ListViewWebPart runat="server" __MarkupType="xmlmarkup" WebPart="true" __WebPartId="{28B30FD4-BA90-4FFE-8EA6-2608237AF16B}" >
...
...
</WebPartPages:ListViewWebPart>
<IsVisible>true</IsVisible>
to
<IsVisible>false</IsVisible>
Be sure that the first listform is now visible when you go to the list with your browser.
In SPD rightclick the first listview and click “Convert to XSLT Data View”. You can now edit every column, value and formula. Create a new column where you want the delete button to be. In my case I want it next to the edit button so I rightclick that column and insert a column to the right.
In the newly created column you can change the header to “Delete” or “Remove” or whatever you want.
Now we need to locate the empty cell in code view. Assuming you have split view we’re going to select only the first two cells (not the header) of the newly created column, you see the code view jump. Now locate the empty
<TD Class="{$<SomeId>}"></TD>
or
<TD Class="{$<SomeId>}">
<xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&nbsp;</xsl:text>
</TD>
in your selected code and replace it with
<TD Class="{$<SomeId>}">
<xsl:choose>
<xsl:when test="ddwrt:IfHasRights(4)">
<a href="javascript: {ddwrt:GenFireServerEvent(concat('__cancel;__delete={ID=',@ID,'};__commit'))}"><img border="0" alt="Edit" src="/_layouts/images/delete.gif" /></a>
</xsl:when>
<xsl:otherwise>
<xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&nbsp;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</TD>
Now we are done, save and enjoy deleting! =)
Update
For them who want to have a conformation box before deleting just insert this code instead of the above:
<TD>
<xsl:choose>
<xsl:when test="ddwrt:IfHasRights(4)">
<a href="javascript: if(confirm('Are you sure you want to delete?')){ddwrt:GenFireServerEvent(concat('__cancel;__delete={ID=',@ID,'};__commit'))}"><img border="0" alt="Edit" src="/_layouts/images/delete.gif" /></a>
</xsl:when>
<xsl:otherwise>
<xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&nbsp;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</TD>