Dec 23, 2008

iLSP - SharePoint Designer “Call a Web Service” Action

“iLSP” – is the abbreviation for iLove SharePoint.

The “Call a WebService” workflow action is included in the iLSP -SharePoint Designer Actions 1.0 release. Installation see readme.txt.

The action supports SOAP 1.1, SOAP 1.2, basic and windows authentication.

Let’s go and call a built-in SharePoint web service – Lists.asmx and create a new List with the AddList operation.

  • Bring up SharePoint Designer and create a new workflow on an list with a “Title” and “Response” (Multiple lines of text – plain text) column.
  • Add the “Call a Web Service” action from the “iLove SharePoint” category


  • Configure the action as follows:
    • URL: http://[siteurl]/_vti_bin/Lists.asmx
    • SOAP Version: SOAP 1.2
    • SOAPAction: not needed for SOAP 1.2
    • Envelope:

<soap12:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soap12="">
<AddList xmlns="">
<description>Created by iLSP action</description>

You can copy the SOAP 1.2 example request from http://[siteurl]/_vti_bin/Lists.asmx?op=AddList

      • For the <listName> insert a reference to the current item’s title.


      • As <description> enter “Created by iLSP action
      • Set the <templateID> to 100” = custom list

  • Response: create a new string workflow variable named “response” and assign it. The action will fill the variable with the response from web service call (xml string).
  • User: leave empty. Empty user = use default credentials.
  • Password: leave empty

Now the “Call a WebService” action is configured.

To check the response, we will write it in the “Response” column of the item using the built-in “Set field in current item” action. Set field to “Response” and “Value” to the above defined workflow variable “response”


Try it – Start the workflow on an item

The response:


The new list:


Because the raw response isn’t very useful, we now parse it using iLSP “Query XML” action. Place the action between the “Call a WebService” and the “Set field in current item” action.

  • Add the “Query XML” action to the workflow


  • Configure the “Query XML” action
    • Input: choose the above defined workflow variable “response
    • XPath: //*[local-name()='List']/@ID
      • You can use any valid XPath expression e.g. count(//*). Is the expression result is a single node it will write the node’s inner XML to the result variable. Is the result a node collection, it will merge all the node’s inner XML separated by an semicolon into the result variable. You should identify the node by the local name, because you can’t use xml namespaces.
    • Result: Create a new string workflow variable named “ListID” and assign it.

The “Query XML” action is now configured

Now modify the “Set field in current item” action so that the response column is set to the ListID variable.


Start the workflow again




iLove SharePoint – SharePoint Designer Actions 1.0

I’ve just uploaded some SharePoint Designer Actions (beta) to my CodePlex project iLove SharePoint.

Included Actions

  • Call a WebService (supports SOAP 1.1 and SOAP 1.2)
  • Query XML
  • Execute SQL (supports ADO Provider Model, returns a scalar value)
  • Get parent folder (returns the ID of the folder)
  • Create a site
  • Start workflow
  • Set role inheritance of an item
  • Clear role assignments of an item
  • Assign role to an item

...other useful Actions can be found under:

At the moment the actions aren't well tested. Any feedback would be appreciated.
I'm going to write some blog posts how to use them soon...

Bye, Christian

Dec 22, 2008

Call WCF Services With PowerShell

Call WCF Services with PowerShell using any binding. Generates proxies on the fly without any tool expect .NET 3.5. You can also discover the service endpoints, bindings and contracts.
  • The PS2WCF script
Download sample WCF Hello Service project and start ConsoleShell
  • Meatdata discovery:

$wsdl = Get-WsdlImporter -wsdlUrl "net.tcp://localhost:8888/HelloService/mex" $wsdl.ImportAllEndpoints() | format-list



Note: For none mex endpoints use: Get-WsdlImporter -wsdlUrl http://anyurl/service.svc?wsdl –httpGet $true

  • Generate the WCF proxy

$proxyTypes = Get-WcfProxy -wsdlUrl "net.tcp://localhost:8888/HelloService/mex"


$proxyTypes = Get-WcfProxy –wsdlImporter $wsdl

$proxyTypes | format-table



  • Call a service operation

$address = New-Object System.ServiceModel.EndpointAddress("net.tcp://localhost:8888/HelloService/")

$binding = new-object System.ServiceModel.NetTcpBinding

$proxy = New-Object $proxyTypes -ArgumentList $binding, $address


or use bindings and addresses generated from WsdlImporter

$endpoints = $wsdl.ImportAllEndpoints()

$proxy = New-Object $proxyTypes($endpoints[0].Binding, $endpoints[0].Address)




By Christian Glessner

Dec 1, 2008

SharePoint Power Event Receiver 2.0 Released!

New Features in Version 2.0:
  • Security: Only Farm Administrators are permitted to edit scripts
  • The scripts will be included in SharePoint site templates (*.stp)
  • New predefined functions: Get-SPSite, Get-SPWeb, Select-SPListItem
  • Supports editing in PowerGUI (needs iLoveSharePoint PowerGUILauncher)
  • Fixes invalid cast issue with $properties, fixes issue with unregistering item events
Download on my Codeplex Project iLove SharePoint.

Bye, Christian

Nov 29, 2008

Manage SharePoint WebParts with PowerShell

  • Get the WebPart Manager:


The function get-spweb is defined in my PowerShell profile.

  • List all web parts on the page



  • Update the "Site Image" - Web Part's image



  • Add a "Content Editor" Web Part



Download the example.

Nov 26, 2008

Unit Testing with SharePoint

Typemock are offering their new product for unit testing SharePoint called Isolator For SharePoint, for a special introduction price. it is the only tool that allows you to unit test SharePoint without a SharePoint server. To learn more click here.

I'm curious testing it...

Nov 11, 2008

Released: SharePoint PowerEventReceivers 1.0

I've just released the PowerEventReceivers 1.0 on iLove SharePoint. Now you can write EventReceivers with PowerShell-Script!


  • All events from the SPItemEventReceiver class
    • ItemAdding, ItemUpdating, ItemDeleting, ItemCheckingIn, ItemCheckingOut, ItemUncheckingOut, ItemAttachmentAdding, ItemAttachmentDeleting, ItemFileMoving, ItemAdded, ItemUpdated, ItemDeleted, ItemCheckedIn, ItemCheckedOut, ItemUncheckedOut, ItemAttachmentAdded, ItemAttachmentDeleted, ItemFileMoved, ItemFileConverted, ContextEvent
  • All events from the SPListEventReceiver class
    • FieldAdded, FieldAdding, FieldDeleted, FieldDeleting, FieldUpdated, FieldUpdating
  • Anything PowerShell can do...

Quick Start:

  • Deploy the solution
  • Activate the Feature


  • Go to the list settings of any list or document library


  • Choose Power Item Event Receiver
  • A Quick Start Guide is included


  • Enter the following script to deny deletion of list items


  • Save
  • Now, try to delete a list item...


  • ...


  • The End

This is just to give you an idea - just be creative...

Please be carefull with the event receivers, they will run with the credentials of the application pool. Although only site collection admins are permitted to edit the script, the script will run with higher privileges! Any idea to improve the security would be appreciated - maybe using a local machine group? What do you think?



Nov 10, 2008

Event Pictures "Auf die Pole Position mit Data One"

The event was really great. Thanks to all!

That's me and Severin Canisius from Jack Wolfskin.                             more pictures

Oct 22, 2008

Hide Columns in SharePoint Forms with PowerShell

To hide columns in SharePoint List Forms like NewForm.aspx or EditForm.aspx seems to be a very common task.

Usually you can create a custom form with SharePoint Designer or enable content types on the list and choose to hide the column in all forms.

Last but not least my favorite way with PowerShell and my PowerShell Shell Scripts:

    $web = get-spweb http://localhost/websites/myweb
    $list = $web.Lists["listTitle"]

    $field = $list.Fields["columnTitle"]
    $field.ShowInDisplayForm = $false
    $field.ShowInEditForm = $false
    $field.ShowInListSettings = $false
    $field.ShowInVersionHistory = $false
    $field.ShowInViewForms = $false
    $field.ShowInNewForm = $false



Certainly you can do much more with SPField...

Oct 8, 2008

Coming Soon: German Version of Nintex Workflow 2007

We've just finished the German translation of Nintex Workflow 2007. Now we're testing...
Release will be available soon.
Thanks to Matthias Bender for the great work.

Sep 30, 2008

SharePoint PowerWebPart V1.0 Released

I've just released the PowerWebPart V1.0!

Execute PowerShell Script in a WebPart
Just perfect for agile SharePoint Development!

    • Simple HTML Rendering
    • Use ASP.NET and SharePoint Controls
    • Supports WebPart Connections (Row Provider/Consumer, Table Provider/Consumer
    • No compile, no packaging, no deploy, no iisresets
    • Anything PowerShell can do :-)

Documentation and examples coming soon!



Sep 29, 2008


I've added a new function to my PowerShell Script Profile called Select-SPListItem.  Usually you have to select the SPListItem's columns via the indexer like $item['Title']. This approach doesn't work great with built in cmdlets like select-object, group-object, sort-object, nor with tools like PowerGadgets (out-chart :-). The idea was to built a function similar to select-object, see below. Yo can use it like this:

$list.Items | Select-SPListItem Title, TaskStatus | group-by TaskStatus


Another way to work more elegant with SPListItems is using the SPListItemCollection.GetDataTable() method.

$list.Items.GetDataTable() | group-by TaskStatus

The downside of this approach could be that it allocates more memory, usually that doesn't matter. I've found this approach on Jesper M. Christensen's blog - thanks.

Sep 25, 2008

Interview PowerActivity with MVP Michael Greth

Here is an inteview about my PowerActivity with MVP Michael Greth (on German, flavoured with "saarländisch"). Rhetorical lousy, but with a lot of passion ;-)

Thanks Michael.

Auf die Pole Position mit Data One

Data One, Microsoft und HP machen Ihr Unternehmen fit für die Pole Position! Damit auch Sie zukünftig Bodenwellen und rutschigen Asphalt umgehen können, zeigen wir Ihnen den richtigen Weg für Ihren Unternehmenserfolg und zukünftige Potenziale

Wie das geht? Ganz einfach: Wir laden Sie ein, sich im Rahmen einer Nachmittagsveranstaltung von den Vorzügen des neuen 2007 Microsoft Office Systems überzeugen zu lassen.

Erleben Sie praxisorientierte und innovative Vorträge von Data One, Microsoft und unseren Kunden. Nutzen Sie die Möglichkeit, an unseren Infopoints mehr über die neue Welt der Microsoft-Software und die Hardwarelösungen von HP für Ihr Unternehmen zu erfahren. Seien Sie immer eine Reifenlänge voraus!

06. November 2008

13:00 Uhr

17:45 Uhr

Parkhotel Albrecht, Völklingen

Detaillierte Informationen zur Agenda entnehmen Sie bitte dem Flyer zur Veranstaltung.

Als Special erwartet Sie eine exklusive Auswahl an sportlichen Fahrzeugen unseres Sponsors Audi, mit denen Sie Ihr Können auch mal außerhalb des Büros unter Beweis stellen können.

Sie wollen den Start in eine erfolgreiche Saison nicht verpassen? Kein Problem - melden Sie sich noch heute online an.

Wir freuen uns auf einen siegreichen Renntag mit Ihnen!

Sep 23, 2008

SOON: PowerWebPart

Hey PowerGuys, actually I'm working on the PowerWebPart and maybe I'll release it this week.


  • Simple HTML Rendering
  • Using ASP.NET and SharePoint Controls
  • Receive ASP.NET Events
  • Runas Current User or Application Pool User
  • Parameters
  • Saving the WebPart as Template and reuse it
  • Security: Only Site Administrators can change the script, other users can only change the parameters
  • WebPart Connections: Table-Provider, Table Consumer, Row Provider, Row Consumer
  • Everything PowerShell can do!


  • Simple HTML-Rendering (get-process)




  • Dynamic ASP.NET Controls + Event Receiving

  • Use SharePoint Controls and Objects and Parameters


Use a parameter for the list title



Any suggestions?

Sep 13, 2008

SharePoint, Workflows and Security

If you are going to develop SharePoint workflows either with Visual Studio or SharePoint Designer you will have to think about security - regardless you want or not.

The most important thing is knowing the windows identity under which your activity will run on SharePoint. That's either the IIS application pool user, in case you stimulate the workflow via the web interface or the Windows SharePoint Services Timer user for scheduled stimulations. The workflow operates with the system privileges of its windows identity. This behavior is the same for both Visual Studio and SharePoint Designer workflows.

Because SharePoint has a security model of its own the windows identity doesn't matter! The granted SharePoint privileges depends on the current SPUser. In case of a Visual Studio workflow the SPUser get from the SPWorkflowActivationProperties' objects is the the SHAREPOINT\system user with full SharePoint privileges.

SharePoint Designer workflows behaves another way. The current SPUser get from the WorkflowContext's objects (e.g. WorkflowContext.Site) is impersonated to the workflow's author, the user who started the workflow. Means the workflow operates with the SharePoint privileges of the author (usually contributor rights) and the system privileges of the windows identity (Application Pool/Timer Service user)!

Impersonation snippet taken out of the WorkflowContext.Site property:

SPSite site = new SPSite(this.m_siteId);
SPUser user = site.RootWeb.SiteUsers[this.m_inProps.Originator];
SPUserToken userToken = user.UserToken;
this.m_site = new SPSite(site.ID, site.Zone, userToken);
If you write a custom activity for SharePoint Designer as described here, you may want to undo this impersonation. You can use the following code snippet in the activities' execution context to undo:

SPSite site = new SPSite(__Context.Site.ID));
SPWeb web = site.AllWebs[__Context.Web.ID]);

You don't need to use the SPSecurity.RunWithElevatedPrivileges method because the current windows identity is the application pool user.  
Now the site and the web run with the SharePoint system user's privileges.
Bye, Christian

Sep 10, 2008

Call a Web Service with SharePoint Designer and PowerActivity

WARNING EXPLICIT SCRIPTS: The example is quiet complex!

  • Create a custom list "Power Snippets"
  • Add a multiple line plain text column, perhaps 60 lines, "PSScript"
  • Define any other list to attach the workflow (Title, Result as Rich Text)
  • Add your snippets to the list (e.g. my Get-WebServiceProxy script (Requirements for this script: Windows SDK (wsdl.exe) and .NET 3.5. )



  • Use the snippet in SharePoint Designer. Add the "Execute PowerShell Activity to your SPD Workflow. Define a workflow variable named "result" type of text to store the result of the web service request. Insert the following script:


  • The [%Power Snippets:PSScript%] is a lookup to our Get-WebServiceProxy script snippet. The lookup makes the Get-WebServiceProxy function available to our script. The lookup is something like an old school PHP-include ;-)image
  • The script bellow the lookup generates a proxy for the SharePoint Lists.asmx webservice, call the GetListCollection method, generates from the response an HTML string containing a bullet list.
  • In the next step we set the "Result" column to the "result" variable we filled before with PowerActivity.


  • Save and start the workflow...image
  • :-)

Another way to call a web service with the PowerActivity would be to create the proxy with or Visual Studio wsdl.exe, compile and deploy the assembly to the global assembly cache of the server. Now you can load the assembly in PowerShell like [System.Reflection.Assembly]::Load... and instantiate the proxy New-Object -TypeName... This solution is faster and you don't need the WinSDK on the server.

Any questions?


Use PowerActivity to Be...

...a bad boy and shutdown your bosses' computer ;-)

shutdown /s /f /m \\computerNameOfYourBoss

image Really useful ;-)


Aug 31, 2008

The Most Powerfull Activity On Earth - The PowerActivity 1.1

Release 1.1 of the PowerActivity for SharePoint Designer is now available.

  • Even faster...
  • Better logging: now error messages will be added to the workflow's history log, stack traces to the event log
  • Syntax for setting the output has changed
        • from: @{"output"="some value"}
        • to: $output = "some value or variable"
  • No error, no fix :-)

Read more: The Most Powerfull Activity On Earth - The PowerActivity

Hint: Use "get-variable > C:\variables.txt" to print out all available PS Variables to the file system.



Aug 22, 2008

First German Nintex Partner: Data One

I'm pleased to announce that Data One is the first German Nintex Partner.

Nintex is a leading innovator of exciting software products that extend Microsoft technology. They are focused on building software which bridges the gap between what can be purchased from Microsoft today and common functionality requested by customers.

Nintex Workflow 2007
Extends Microsoft SharePoint 2007 and Windows SharePoint Services 3.0 to provide advanced workflow capabilities via a graphical web based interface embedded within SharePoint.

Nintex Reporting 2008
Monitor, audit, and gain valuable insight from the content and activity information within Microsoft SharePoint.

Nintex Podcast Server 2008
Provides organisations with a centralised, easy to use solution to create, manage and distribute Podcasts. Built on Microsoft SharePoint 2007 technology, Nintex Podcast Server enables users to create Podcasts online via an easy to use interface.

Really cool stuff...

Aug 16, 2008

Back and Forth - Lookup Field with Picker and Lookup

I've added two PowerShell Scripts (ConvertLookupFieldWithPickerToLookup.ps1,ConvertLookupToLookupFieldWithPicker.ps1) to my Lookup Field with Picker Release. With this scripts you can convert an built-in SharePoint Lookup to my Lookup Field with Picker and the reverse way my Lookup Field with Picker to an built-in Lookup. Means you can extend an already existing solution with my lookup with picker. On the other hand, if you don't like my lookup with picker (hard to believe;-), just convert back to the boring built-in lookup. Maybe useful for an upgrade to Office 14 - who knows?

  • Convert Lookup to Lookup Field with Picker:

PS>& .\ConvertLookupFieldWithPickerToLookup.ps1 http://[server:port]/site/subsite [ListName] [FieldTitle]

  • Convert Lookup Field with Picker to Lookup

PS>& .\ConvertLookupFieldWithPickerToLookup.ps1 http://[server:port]/site/subsite [ListName] [FieldTitle]

At the moment the script supports only list fields, no contet type fields. Do you need it? Let me know...



Aug 15, 2008

Add the SharePoint List Item's Context Menu to any Column with PowerShell

With this PowerShell script you can add the list item's context menu to any column you want. You'll find the script (AddMenuColumn.ps1) on my Codeplex Project iLoveSharePoint.

I'll just give you an example how to use:

  • Let's assume you have a calculated list column called "justAnyColumn" with the following formula "[Title]&[Content Type]"


  • In this scenario we assume you don't need the title column, instead you want to show the "justAnyColumn" to select an entry. But unfortunately the context menu is attached to the title column. And now?!


  • We could show the "Edit (link to edit item)" column in the view.image
  • May be a solution - But our users are accustomed to use the context menu. Well!
  • Now you can use my script:
  • Start the PowerShell
  • Run my script as follows:
  • PS> & .\AddMenuColumn.ps1 -webUrl http://[server:port]/site/subsite/ -listName "Test" -fieldTitle "justAnyColumn" -addToDefaultView $true
  • Let's take a look at the result:


  • Now you've got a new column, containing the value of "justAnyColumn" with attached context menu.
  • That's all!

How to remove the column?

  • Because the column is read only in the UI, you can't delete there.
  • Instead use my iLovePowerShell script:
    • PS> $web = get-spweb http://[server:port]/site/subsite/
    • PS> $list = $web.Lists["Test"]
    • PS> $field = $list.Fields["justAnyColumn"]; #better would be to use the Guid of the field, because the field name exists twice
    • PS> $field.ReadOnyField = $false
    • PS> $field.Update()
    • PS> $field.Delete()
    • PS> $web.Dispose()

Hope somebody can use this...