Error: Configuration file is not well-formed XML

This error message occured on the IIS 7 on my SharePoint server this morning (running on win server 2008). How come? Well it all started with this: I was going to add an account on a site, but the AD did not reply, which forced me in to the server to have a look. Turned out that the SharePoint server had 0 KB left on C: drive! No wonder you can’t do anything on the site… Found out that the inetpublogs folder had grown to a whole 16 GB! Log files!! Crazy! Started IIS 7 and looked in the “Logging”:

By default the settings are set to schedule Daily (!) and without limits. It has nothing to do with the usage logging in SharePoint because those files resides in the 12 hive under logs there. And those were “only” 4 GB. Entered a new path from c: drive to the E:drive that has more space, and clicked on “Apply”…. and the IIS crashed. With this message:

Performed an IIS reset, same error message.
Restarted the server, same error message.
Panic! The IIS was dead.

Googled it, and found this article (thanks!!):
http://www.tekniken.nu/drift_och_underhall/forefront_saboterar_iis_7

So I looked inside the C:Windowssystem32inetservconfigapplicationHost.config folder and the applicationhost.config file size was 0 KB so I renamed that one to old_applicationhost.config and opened the history folder and selected the newest applicationhost.config file. Pasted it to the C:Windowssystem32inetservconfig and performed an IISRESET. Phew…. it’s all back again….

Steps for the future are:

– move all log files to the E drive

– config the IIS log settings and add a limit

Display week number in a view

To calculate the week number in a view, enter following formula in a calculated column:

Replace the “Yourdatefieldhere” with the column that contains the date field you want to calculate the formula on. Thanks to http://lamahashim.blogspot.com/2009/10/sharepoint-calculated-field-week-number.html for the formula.

Swedish version
=HELTAL((Yourdatefieldhere-DATUM(ÅR(Yourdatefieldhere);1;1)+(TEXT(VECKODAG(DATUM(ÅR(Yourdatefieldhere);1;1));”d”)))/7)+1

English version
=INT((Yourdatefieldhere-DATE(YEAR(Yourdatefieldhere),1,1)+(TEXT(WEEKDAY(DATE(YEAR(Yourdatefieldhere),1,1)),”d”)))/7)+1

More examples of view formulas here

Center align a div in IE 8

Usually when I want to center align a div on a page, I use margin:auto auto and set my width to a specific width, like 940px in my stylesheet. But, this does NOT work in IE 8. So to make that work, use

width:940px
height:100%
position:absolute
left:50% (to tell that your div should start in the middle of the page)
margin-left:-490px (half of your div size)

Thanks to this site

Calculate date fields in SharePoint lists

I wanted a custom view where the news are sorted per Year and Month, and then after modified date descending order. I created a new field called Year and used the following formula to calculate year which is really easy:

=YEAR(Created)

Then I wanted to get the name of the month instead of the number so I used this formula (this is the swedish version, use comma instead of semicolon in the english version):

=OM(MÅNAD(Skapad)=1;”Januari”;””)&OM(MÅNAD(Skapad)=2;”Februari”;””) and so on… You must put an empty “” after or else it will write the word “False” in your view =)

In English:

=IF(MONTH(Created)=1, “January”,””)

Stop running this script

If you connect a secondary data source to your InfoPath form, and connect to a udcx file which contains a large amount of data: then you might get this error message inside the form:

Very irritating! I did not find any solution to it, only that you can disable the script debugger in IE, but hey – we are talking clients here! I will not be able to edit IE settings on my users computers right =)

The solution to this issue was to import the sql table to a SharePoint list, and then lookup against that list. Error message? GONE! 🙂

Create your own search control

I was looking for a way to get rid of the icon gosearch.gif in the Search Area in SharePoint:
There is no way to replace the image with a css class, the only thing you can do is hide it with a new class that is called td.sbgo img and add the display:none to it.

So you must create a new feature, which is really easy.

Copy the OSearchBasicFeature folder in the Feature directory in the 12 hive.

Rename to whatever you like, LisesSearch is fine =)

Edit the feature.xml file and add a new GUID (link here)

Edit the SearchArea.xml file and add the path to your own search button (I put an image in the IMAGES folder, actually I created a new folder beneath it where I put my own search image):

Rename the Control Id in this file to something else like “LisesSearch”

Install and activate the feature

stsadm -o installfeature -filename LisesSearchfeature.xml
stsadm -o activatefeature -id “YourGUIDhere” -url http://yoursitehere/

Now, in your masterpage just edit the Control Id of the aspcontentholder “PlaceHolderSearchArea” to your own Id (in this example LisesSearch).
Now (after some branding on the sbcell and sbgo classes) the search should have your own buttons:

Gert rid of those login prompts

This post belongs to my issue described here which I have not found a solution to yet. Except from one of the issues: the login prompts!
When you run a Vista client against your SharePoint site that you have installed on a Win Server 2008 then you are in trouble. First thing: dont run Vista, but if you do, then you will have the following issues:

1) you get three (!) login prompts when you want to open, edit or modify stuff on your site
2) you cannot map network drive
3) you cannot open a library in explorer view

But, yesterday I laborated and found that there is a solution to nr 1 – the login prompts. If you stop the WebClient service on your Vista client, add your site as a Local intranet in IE and set your LAN settings in IE to “Automatically detect settings”, the login prompts will disappear!!

If you don’t set your WebClient service to manual then you have to stop it each time you restart the PC so remember to turn it off and not just stop the service.

I will register a case at MS to find a solution for the other issues.

Filter on secondary data sources in InfoPath

I have built many forms in InfoPath 2007 and you always find new interesting issues to deal with =)

When you think you have found a brilliant solution, then you can be sure that there is an obstacle when it comes to web enabled forms. So it works with filter on data sources.

I wanted to drag and drop a secondary data source to my form, but I wanted it to show only values that matched a field value in my form. Let me clear: only values in the data source that belonged to the current user should be displayed in the repeating table. Easy, I thought and clicked the “Value” button and then the “Filter data…”. Got this error message:

Hmm after hours of trixing with setting the field from other fields and so on, I disabled the web enabled layout. Now you may press the “Filter data…” button and set your filter. Web enable the form again, publish it and just press the “Ignore error messages” and continue with the publishing…. It worked!

So that error message is BS. I have saved the form, and all data remains in the form.

And now – a commercial break :)

My good friend Tobias Zimmergren has released his awesome Forum product for SharePoint.
I hereby quote Tozit himself:
“The TOZIT SharePoint Discussion Forum solution is a product, or set of products, that makes the discussions in SharePoint become very intuitive and user friendly. It also adds on a bunch of features that doesn’t normally exist in SharePoint’s built-in discussion lists”
Have a look here, it looks really cool!!