Does SharePoint needs Configuration?

Hello everyone,

I recently had to deal with a weird SP2010 error. The error message that the client received was as follows

“L’opération de montage de l’application rassembleur GUID a échoué, car la version du schéma de la base de données d’administration de recherche est inférieure à la version du schéma de compatibilité descendante minimale prise en charge pour cette application rassembleur. La base de données n’a peut-être pas été mise à niveau.”

(Yes the installation is in French). I must admit that sometimes the terms used in the error messages are very obscure .. (I naively thought that an error message would help …)

After conversation with the client, he tells me that the only operation that has been done on its SharePoint was the passage of a KB fix, no upgrade of server or anything else.
After some research, I found the English version of the error message (all french talking people know we have a lot more answers when looking for an error message in English)

This therefore gives

“The mount operation for the gatherer application GUID has failed because the schema version of the search administration database is less than the minimum backwards compatibility schema version supported for this gatherer application. The database might not have been upgraded”

And thanks to this English version I could find possible solution. One possibility is that this error message may appear if you install a service pack without restarting the SharePoint configuration wizard. Yes but how do you know if the wizard was done without launching it (and therefore without downtime of the server)? For this there is a powershell command which will ask nicely to our SharePoint if we need to run this wizard!.

The command is



(get-spserver $env:computername).NeedsUpgrade

A command that is executed quickly and returns “True” or “False”. If this is true, that means the wizard must be run (which was the case for me).

So change folder to get the PSConfig.exe found in “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN” and execute the command


PSConfig.exe -cmd upgrade -inplace b2b -force -cmd applicationcontent -install -cmd installfeatures

And now, the server is updated and the error is gone!

Hope this helps!

Christopher.

Get current item in custom list form


Hello everyone

In a previous article, I wrote about how to customize list forms.

Today I’ll talk about 3 things about custom forms.

1) How to get the current item                                     

To retrieve the current itemyou have to go through the itemcontext of ListFormWebPart

1

2) Close the form.

At the end of my button click, I used the following three lines to close the popup and refresh the calling page.

2
3) Associate an event to a button

Doing my development, I noticed a strange thing when I tried to add a button.

In my custom page, I set the button as follows.

3

My function was defined in my code behind but when I click on button, my code behind was never executed!

To avoid this, I attached my event in the “onload” of the page, and since it works perfectly.

4

Hope this help !

Christopher.

Modify list forms.


Hello everyone,

Today I’ll talk about the steps required to change pages lists forms (new,edit,display).

Those pages are in fact webpart pages, so we can add elements to customize our forms. (Text, Image, Button, etc …)

Looking for information, I realized that I found mostly tutorials to make changes via SharePoint Designer and very little via code server.

Personally for the sake of reusability, I prefer use wsp packages containing my changes instead of working with SPD.

Here are the steps necessary to change the “form” of a list.

Go to your Visual Studio Solution.

1) Within your list definition, add a new “Application Page”.

Just use the standard “Application Page” Template available when you select “Add new item”.

01

2) Change deployment type of this page.

In the page properties, select « Element File ».

02
3) Copy the contents of the default SharePoint form.

Creating our aspx page using Visual Studio, we have a file looking like this.

03
To continue, we only need the specific elements of our solution namely the import of the solution assembly and the link to the page with cs source code.

So delete the rest for a file containing only our two lines.

04

If we look at the contents of the file “Schema.xml” our list definition, we can see that the forms rely on the “form.aspx”

05

This page is located in the 14 Hive, within the folder « TEMPLATE\Pages »

06

Open this page and then copy the entire page in our “Application Page”. Done, delete the tag “Page” copied from the file “form” of SharePoint

07

Also change the parameter « DynamicMasterPageFile=”~masterurl/default.master”

» by « MasterPageFile=”~masterurl/default.master” » within the tag « Page »

4) Page code behind.

The code behind must inherit from the class Microsoft.SharePoint.WebPartPages. WebPartPage

08

5) Associate the new page as a new “Form” from the list.

In our file “schema.xml” we will modify the forms associations, we will change the parameter “SetupPath” by  “Path” which will target our new page.

09

Become

10

With these changes we have replaced the “new form” of our page.

To test our changes, we will add a message on the page.

In our file “ApplicationPage1.aspx” seek the happy place holder “PlaceHolderMain” and add our text.

11

Now deploying our solution and let’s add an element.

12

This approach allows using the native component added, however we may also use another component or even a standard component by changing the parameters.

To do this, simply specify in schema.xml that we do not use the standard ListForm and inform the Web Part that you want to use.

In the example below, we will change the edit form, we will use the standard Web Part and add a content editor webpart.

14

After deploying the edit form contains the content editor webpart.

15

One last example, if we do not use the default list form webpart , we can use the parameter “UseDefaultListFormWebPart =” False “”

16

Et voilà !

Christopher.

Its over 9000!

Hello everyone,

When I started this blog, I really did not think that so many people would read what I write!

So what a surprise to have reach 10000 visits in less than a year! I’m really happy about this! I’ll try to continue sharing what I discover about SharePoint!

I remember when I started working with SP and didn’t find answer to my questions, so frustrating! Now when you do a search , you have a lot of information, the SharePoint community is now very active and that’s really cool!

See you next time for a new post!.

Add Newline in “Note” field programmatically


Hello everyone ,

Today I’ll talk about a request that I had recently:  Update a field note with a return line to each entry.

### Context presentation region ###

I had a content type on a list item with one of the fields used as a “Status” field (“Draft”, “Pending”, etc. ..). The change in status was done through a workflow.

It wass needed to log every status change and every information from the workflow (who approved / rejected a task, who approved for a task assigned to a group, etc. ..) and all that being visible from the first glance at the item.

To do it, I used a field of type “note” on the item in which I added the informations.

I first used the parameter “AppendOnly” in my field definition.

With this parameter when filling the field, you have the name of the current user, the date and the text added.

It can be usefull but in my case the Workflow data displayed were preceded by “System Account”.

I could not update the log every task change (the end of update Workflow would be generated because the element was changed), I recovered all the data from the Workflow History list on the event WorkflowCompleted. So I refrained from using the “AppendOnly.”

But then, I realized that when I update my field, my text has no return line and the visual was not goof. So I searched how to simulate a newline in a string.

### End Context presentation region ###

Being naive, I tried to put a <br/> tag in the string.

Obviously, that did not work.

I did some research and I came across an article saying that I should use <![CDATA[<br/>]]> to generate a new line. I tested it without success. It seems that it works on the Note fields with HTML (I’ll have to test this on occasion).

Looking for a little more, I found the right solution, use a System.Environment.NewLine to generate a newline!

Summary :

  •  « AppendOnly= ‘True’ » parameter :
    • On each modification, adds an entry with the format (User – Date – content).
  • Insert « System.Environment.NewLine » :
    • Add a newline in the field “note” with type “plain text.”
  • Insert <![CDATA[<br/>]]> :
    • Add a newline in the field “note” with type « Rich text » (still need to test this).

Hope this help !

Christopher.