Add color to list

Hello everyone,

Today I will talk about a little query I received recently from a client.

He wanted a list of tasks in color!

The principle was simple: If a task is completed, it appears in green, if the task is not completed and has the highest priority (level (1) High), it must be displayed in red.

For once I tried to use JavaScript instead of starting in a custom development. It did not look that complicated!

Here is an overview of our task list.

To begin , we need to add a Content Editor Web Part to the page where the list is displayed. We must add ListViewWebPart below the list.

If we check the classes applied to the cells, we can see that the class used for a list of fields is the class’ ms-VB2 “. So we will recover all the cells of the page and test those whose class is “ms-VB2”. Then we will check the contents of each cell and apply the desired style if needed. If the task is finished (“Completed”), we apply the color “lightgreen” to the entire line. If the job status is important (“(1) High”) and not completed, we apply the color “red” to the line.

 <script language="javascript" type="text/javascript"> var x = document.getElementsByTagName("TD") var i=0; for (i=0;i<x.length;i++) { if (x[i].className=="ms-vb2") { if (x[i].innerHTML=="Completed") { x[i]'lightgreen'; } if (x[i].innerHTML=="(1) High" && x[i]!='lightgreen') { x[i]'red'; } } } </script> 


A simple code to display the tasks in color!

This small code will look at the contents of each cell in the list and if it finds the corresponding text he applies the right color. But be careful, if you have “Completed” or “(1) High” as content of another field that will change color.

For further testing jQuery is necessary, I will perhaps talk about this in a future article.


Working without SQL Express on standalone

Hello everyone,

Today I will talk about restoring the database. When you want to debug an application it is sometimes necessary to reproduce exactly the same environment as production. But then if we develop on a “standalone” machine, we can face a message like:

The Database was backed up on a server running version XXXXXX. That version is incompatible with this server, which is running version YYYYYY

Where YYYYY is smaller than XXXX. And even if we did all available updates!

The reason is, by default when installing a “standalone” version of SharePoint, even if we have installed a SQL Server before you install SharePoint, it installs the SharePoint databases in a SQL Express instance!

And therefore, can not restore a backup database from a production SQL Server that is not SQL Express.

To avoid this, there is a small tip.

When installing SharePoint in “standalone”, it will seek a default SQL instance named”SharePoint”, and if he does not find it, he created it on SQL Express!

To avoid this, when installing SQL Server on the development machine, create a “Sharepoint” instance and voila!

Hope this helps!


Use InfoPath form in Workflow

Hi everyone,

Today I’ll talk Workflow with InfoPath , especially the steps needed to attach the form to a task.

Step 1: Creating the module

First start by adding a module called “Forms” in our workflow in order to have a solution that looks like this.

Step 2: Add the InfoPath form to the module

Then create our infopath.

Nothing complicated here, the idea of this article is just to show how to integrate ourcustom form in a SharePoint task.

Once the form is done, a modification of the loan security is necessary, for this we must go the menu “File” – “Form Options”

Here we need to specify security at least on “Domain”.

Once this security in place, publish our form. We will publish it directly into our project.For this we must go to the tab publication and choose to publish on the network.

Select the location of our module “Forms” that we created in our workflow.

The next step is very important, we must empty the link to access our form!

This generates an error message when clicking next, click “OK” to ignore.

Let’s get to publish the form.

Once the form is published, get back to our Visual Studio solution and display all files by clicking the appropriate button.

Do a right click on our infopath to add it to the solution.

We can see in the Elements.xml file thath the form has been automatically added to the module.

Step 3: Edit the “feature.xml”

Now that infopath is added, we must deploy it to our SharePoint environment. For this we must add a specific receiver in the manifest of the feature.

ReceiverAssembly = "Microsoft.Office.Workflow.Feature, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c"

ReceiverClass = "Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver"

That’s this receiver which will upload the infopath. We must also specify the following property so it knows where to look for forms.

<Property Key="RegisterForms" Value="Forms\*.xsn"/>

In the end we have a manifest that looks like this

Step 4: Edit the workflow’s “Elements.xml” file

We now need the ID of OOB content type “SharePoint Workflow Task InfoPath” in our definition.

<Workflow …

TaskListContentTypeId="0x01080100C9C9515DE4E24001905074F980F93160" >

We must also specify the urn of our infopath. Caution! Make sure you have the urn of the published form!


For each form you can specify the ID here the example “<Task0_FormURN>” shows the ID 0, remember this ID we will use it right after!

Ultimately our file “Elements.xml” should look like this

Step 5: Changing the code to create the task.

In our workflow we can now specify the form that we use, for that we must change the properties of the task by giving the ID of the appropriate form, in our example we will give him the ID 0.

Our code looks like this

Step 6: Checking.

After deploying the solution we should find our form in the central administration more precisely in “General Application settings” – “Manage form templates”

And indeed it is present.

By starting our workflow when creating the task we can see our form!

Voila !


SharePoint 2010 Updates

Hi everyone,

Today I’ll talk about the update of SharePoint 2010.

First of all, you can find them here :

One of the new things of the 2010 version is that you no longer need to install the Foundation cumulative update when you install the Server!


Yes, but… because there is a but, for the service pack 1, it seems that this causes malfunctions.

This is why for the service pack, it is best to keep the old ways and install the differentservice pack version, namely:

1. Service Pack 1 for SharePoint Foundation 2010

2. Service Pack 1 for SharePoint Foundation 2010 Language Pack (if applicable)

3. Service Pack 1 for SharePoint Server 2010

4. Service Pack 1 for SharePoint Server 2010 Language Pack (if applicable)

If you want more information on the implementation of a service pack, I recommendreading this post by Spencer Harbar :