Category: CodePlex

I created an alternated notification feature for SharePoint 2010. It’s a demo project for SharePoint 2010. I’ve done it for some practice in SharePoint development and just for fun 🙂

It’s intended to replace the default notification feature of SharePoint 2010 where you can subscribe to notifications list based. – With my feature a user can subscribe to all changes of a SharePoint Web by using a menu entry in the Personal Actions menu.

The notification mail is send to any subscribing user once a day. (Please notice that at the moment there is no security trimming for the notification mail!)

7. If the web scoped feature is deactivated the list event receiver and all list item event receivers are removed. If the feature gets activated the list event receiver and a list item event receiver for each existing list are registered.

8. The farm scoped feature deploys a timer job that scans each web of a specific web application. If the web feature is active in a web the timer job looks for the change log list and for subscribers. If there are at least one subscriber and at least one one change since the last job run the notification mail is send.

9. It’s localized for german and english. The notification mail text is part of a resource file. But the resource file value for the mail text can be replaced by using a Web Property.

10. The notification mail is not security trimmed! That’s important for use in a production environment!

11. It’s tested in both a german and an english SharePoint system with both language packs, with multiple site collections and multiple webs and sub webs. I’d like to hear your experiences. Please report any bug. Feel free to modify it but please send me your improvements!

Starting at 12th of September 2011 I’ll be freelancer. – In August I had some vacation days to spend. – So I created a new project for me – and for you.

I call it “Web based PowerShell Console” or “WebPSConsole”.

It is a full featured Browser based PowerShell console that enables you to work on a server machine remotely. It’s like PowerShell remoting but it’s not the same. While PowerShell remoting uses “WinRM” the tool that I’ve created uses a “normal” PowerShell host that will be executed in an IIS environment. (Please see my comment related to “PowerGUI Pro Mobile Shell” at the end of this article.)

That means: With my tool you will have a ASP.NET 4.0 based Web Application that can be accessed by a browser. The ASP.NET web app has a .ASPX site and some code behind. On the server in the ASP.NET context a PowerShell Host developed by me is running that accepts commands send by the clients Browser. If a command is send it will be executed by the PowerShell Host. All output is send back to the clients Browser.

It’s on Codeplex: http://webpsconsole.codeplex.com with all source code! – It’s ALPHA. I’ve done lots of testing but I’m a single developer with a single machine… I’d be happy to get your improvements or experiences!

Lets have a look at the app:

That is the “GUI”. The black frame will contain the output of the server side PowerShell session.

Let’s enter a command.

get-childitem c:\windows | select -first 5

After clicking “Send” the command is send to the server. The server executes the command and returns the PowerShell output.

Let’s try this:

get-credential

You see the blue colored input box for the credential information input.

Here you see the implemented “session timeout”:

After 15 minutes of inactivity you’ll get a warning. After 20 minutes the session will be terminated. After termination you are not able to access the old session including session history!

Let’s try this:

a$ = read-host

Here you get an input field for a single line of text. The output is stored in variable $a. Let’s check the content of variable $a after sending the input:

Now let’s test the functionality of completing missing cmdlet parameters:

get-content

Leave the last line empty and click “Send”.

You get:

Now let’s test the “choice” functionality:

After “Send” you get:

You see here the blue colored choice input field. If you choose “Halt Command” in this case the “Hello Ingo” command will not be executed:

If you select “Cancel” in such cases the complete PowerShell pipeline will be stopped! Not only the current command!

You can set colors a you need to:

Than “Send” and test it with:

You’ll get:

Now let’s have a look at the function “Download console as RTF”. You’ll find the link above the console frame.

Click “Open”.

This is a Rich Text Format copy of the complete console output! – A “Clear-Host” will not clear this output! – This file can only be downloaded while the current session running. After the session ends you will not be able to access the information anymore!

Let’s try “Show current buffer”. This command is above the console frame too.

Here you get the “real” PowerShell buffer as HTML. This page can be save.

Let’s try:

clear-host

Open “Show current buffer” again:

(It’s empty now because clear-host did clear the PowerShell buffer!)

A word to the keyboard usability:

In the command input field you can use ESCAPE to clear the input field.

You can use CTRL+ENTER to send the command.

In other input fields (choice, credential, read-line,…) except “Read-Key” (see below) you can use ESCAPE to cancel the current operation and pipeline.

You can use there ENTER to send your entered data.

You can use TAB and SHIFT+TAB to navigate inside the input frame: input field, Send button and Cancel button.

The “Trace log” is an optional frame that maybe shows more information about your server connection and the “work behind”. Just click the line and the frame will be shown:

(“Send buffer as HTML” is caused by the “Show current buffer” function.)

You can close the PowerShell session by clicking the “x” in the dialog title (beside “v0.1.0.0”):

Now you can close the Browser or click “Ok” to start a new session. Or reload the Browser page to create a new session.

Setup

Now I want to tell you how to install the project.

First of all you need IIS. This can be installed on Windows 7 too.

You need a user account for executing PowerShell at server side. This account is used by every user of WebPSConsole: Each user of WebPSConsole will be impersonated at the server with the “execution account”. Here you should choose the account very carefully.

1.

Create a directory on the server where you store the binaries. You create a folder “c:\inetput\webpsconsole”.

2.

Copy the binaries there.

3.

Open IIS Manager.

Create a new Application Pool for the “execution account”. This account need to execute ASP.NET 4.0 code.

Select “Classical Mode” for the application pool! – Please check the settings. In my case the settings were not used. After creating the app pool I had to edit it and set “Pipeline Mode” and “Framework Version” again!!!

4.

Create a new web application “WebPSConsole” using the previously created application pool.

Right click the “Sites” node in IIS Manager.

You get this dialog. Fill in your specific informations. Here is my sample. I’ll use “ikWebPSConsole” as host header name in this setup demo because the host header “webpsconsole” already exists for development purpose.

Click the “Select” button beside “Application pool:

“OK”.

My sample data:

(In order to get this working on my machine I have to edit c:\windows\system32\driver\etc\hosts and insert “ikWebPSConsole” as new local DNS entry.)

As I said I’ve developed this project in my last vacation. After finishing v0.1.0.0 I’ve seen PowerGUI Pro MobileShell by Quest Software. It’s based on the same idea as my project but is older and has more features I think. I only know a YouTube video of it because I do not know the commercial version of PowerGUI. – Beside this the free PowerGUI tool is my favorite PowerShell IDE. – For use on a live server you should think about using PowerGUI Pro MobileShell!

In this walkthrough I want to show you how to create a Sequential Workflow with Visual Studio 2010 for use in SharePoint 2010. – I will show how to create a custom Task Form for interaction with users. The Task form will be a native SharePoint list form. No InfoPath. There are many InfoPath samples out there but they cannot be used on a SharePoint Foundation 2010 platform. But workflows can be used on SharePoint Foundation 2010 too!

To reproduce the following steps you need to create a SharePoint site. – In the walkthrough I’ll use a Site Collection located at “http://sharepoint.local/sites/workflow”.

The “TemplateType” attribute represents the “Workflow History” list template. It resists on a SharePoint feature with ID “00BFEA71-4EA5-48D4-A4AD-305CF7030140”. It’s a native SharePoint feature.

You can add the attibute “Hidden” to the “ListInstance” tag and set it’s value to “TRUE” to hide the list as it’s done by SharePoint by default for this list. In this case you should also change “OnQuickLaunch” to “FALSE”. For my demo purpose I want to have “Workflow History” visible and on the Quick Launch bar.

5. Now we will create all tools we need for a “Workflow 1”. (May be I’ll create more workflow demos later. So it’s number 1.)

Use “Workflow 1 Tasks” as name of the list definition and “Tasks” as base type. Check “Add a list instance…”.

10. Now open “Elements.xml” of the new list definition project item.

We need to change the identifier of the list type we create! – It must be “107”. This is the list template ID for workflow tasks lists in SharePoint. The workflow designer will search for a list with this type inside the site where a new workflow will be created.

Here is the content of “Elements.xml” after our modification:

1:<?xmlversion="1.0"encoding="utf-8"?>

2:<Elementsxmlns="http://schemas.microsoft.com/sharepoint/">

3: <ListTemplate

4:Name="Workflow 1 Tasks"

5:Type="107"

6:BaseType="0"

7:OnQuickLaunch="TRUE"

8:SecurityBits="11"

9:Sequence="360"

10:DisplayName="Workflow 1 Tasks"

11:Description="Tasks of Workflow 1"

12:Image="/_layouts/images/itgen.png"/>

13:</Elements>

11. Now we modify the “Elements.xml” file of the list instance that will be created during deployment:

Here we also need to modify the type identifier to “107”. Furthermore we change the list url: “Lists/Workflow1Tasks”.

Here is the complete content of “Elements.xml”:

1:<?xmlversion="1.0"encoding="utf-8"?>

2:<Elementsxmlns="http://schemas.microsoft.com/sharepoint/">

3: <ListInstanceTitle="Workflow 1 Tasks"

4:OnQuickLaunch="TRUE"

5:TemplateType="107"

6:Url="Lists/Workflow1Tasks"

7:Description="Tasks of Workflow 1">

8: </ListInstance>

9:</Elements>

In a “real world” scenario we would prevent the list from being listed on the Quick Launch bar. So the corresponding parameter must be set to “FALSE”.

12. Now we need to modify the “Schema.xml” file of the list definition.

First we set the list type to “107” and configure some other attributes:

1:<Listxmlns:ows="Microsoft SharePoint"Title="Workflow 1 Tasks"

2:FolderCreation="FALSE"Direction="$Resources:Direction;"

3:EnableContentTypes="TRUE"VersioningEnabled="TRUE"

4:Url="Lists/Workflow1Tasks"

5:Type="107"BaseType="0"

6:xmlns="http://schemas.microsoft.com/sharepoint/">

7:[…]

Now remove the the content types defined in the “ContentTypes” tag in the “schema.xml” file.

15. Have a look into the site using the browser. – We will test our “Edit” form. Remember that we did not specify special “New” form or “Display” form. This you could do the same way as you created the “Edit” form.

We see our lists in the Quick Launch.

Open the “Workflow 1 Tasks” list. On the Ribbon open the “Items” tab. We see our Content Type in the New Item submenu:

Create an item of this type. You see a standard “New” form and on it you see our three “Test” fields:

Enter some data and press “Save”.

Open the item in “Edit” form. Now you should see our custom list form.

If you click “Save As Draft” your changes will be stored in the task item. If you click “Complete Task” two item fields will be changed in addition to the changes made in the form: It sets “Status” to “Tasks_Completed” and “% Complete” to “100”. You can see this in the Code Behind file of the list form.

Test all buttons.

After “Complete Task”:

You see: “% Complete” is set to “100 %”.

So far our projects works as expected.

See Part 2 for the next steps… There I will show you how to create a simple Sequential Workflow that uses our Task Form.

I’ve uploaded another private demo project. It was planned as part of an SharePoint solution I liked to create but I cannot finalize this project. So I publish this project as “stand alone” project…. You may find it useful.

You are invited to use / develop / update the project! Every help is welcome!

The intention of the project is to create a possibility to export SharePoint lists to "plain" Excel files. Not the kind of Excel files you can download by using the SharePoint standard functionality: With that you download a "linked" Excel file that contains a permanent connection the SharePoint. It’s a query. – With my project you’ll download a real XLSX file. – And you have the possibility to store an template file that contains formatting instructions.

It’s not finished but it works! – The test project included in the source code demonstrates the feature. Use "Test List 1". (Not "Test List 2".)

Some screenshots:

This is the “Test List 1”:

There is a link in the upper right. This you can use to download the Excel file:

When you click the link you get the well known download window:

Clicking “Open” will open the Excel Viewer – or the “real” Excel (that I do not have on my dev machine).

In Excel you can resize the “C” column.

May you have seen it: There is an error in the solution: Date values are not exported correctly. There is a gap of 1 day…

I wanted to create a sample project to show you who you can create a custom SharePoint 2010 Ribbon tab at runtime! – Especially: How to active the custom ribbon tab on “page loaded” (no need to click it!) So this article is an addition to my explanations in my previous article “How To Activate SharePoint Ribbon Tab by JavaScript Code”.

You are invited to download / update / improve the project! – I’d like to insert more samples in the project about how to deploy Ribbon customizations. In the sample I created a ribbon in a custom list view web page. (You’ll see in the code).

To use the project you need a SharePoint web application named “http://sharepoint.local” and a site collection named “ribbon”.

Deploy the project.

Open the SharePoint site and it’s list in your browser.

You’ll see:

This tab is actived automatically on page load!!!

The source code of my project is inspired by some blog post of this people:

DISCLAIMER

The informations on my blog are provided as is and I cannot guarantee that editing the registry or executing the provided code or provided scripts or doing other actions described in my articles will not cause serious damage. You use this information at your own risk! - I'm not responsible content on external sites.