Friday, October 16, 2009

Maintenance of Sharepoint Web Parts

For some reason, all the web parts ever added to a page in Sharepoint are actually never really removed when you delete them from the page. You can see this for example when you edit the page in Sharepoint Designer. Actually it is a good feature which allows you to retrieve webparts which could have been accidently removed by a user.

You can also remove or clean up the not used web parts in a page by using the Web Part Maintenance page.





It also allows you to remove buggy web parts which prevent your page to load.

You can access this maintenance page by going to the following page:

http(s)://[site-collection-root]/_layouts/spcontnt.aspx?url=[relative path to the page]

Tuesday, October 13, 2009

Vista, svchost.exe and my CPU

Last week I started to have issues with my Vista Laptop. Until now Vista has been great with me, I never understood why people complained about it anyway. After each boot and login my cpu maxed out. Initially with taskmanager I was not able to see which process was eating my processor, so got the tool Process Explorer (Sysinternals ... now Microsoft) and watched what happened.

It seemed that the svchost.exe was eating all my cpu cycles. Hovering with the mouse on it showed the services which it involved.



There was definitely a service which was doing something terribly wrong. Right click - Properties and then the Threads tab showed me that the dnsrslvr.dll!Reg_DoRegisterAdapter+0x501 was the cause. After googling for this I found only 1 entry, which luckily was the entry which helped me.

Summary on how to resolve this is as follows:

There seems to be a network adapter definition in the registry which is incorrectly referenced. In order to find this you need to use the Process Monitor tool and filter on the registery changes only and you will see a lot of entries like:

RegOpenKey HKLM\System\CurrentControlSet\Services\Tcpip\Parameters\DNSRegisteredAdapters\{0751F0D9-4F38-4FCB-8EA8-2E05F05FC711} SUCCESS Desired Access: Read

What you now need to do is to get the GUID of the adapter, in the example above it is:
0751F0D9-4F38-4FCB-8EA8-2E05F05FC711

and use the registry editor and navigate to the following path:

HKLM\System\CurrentControlSet\Services\Tcpip\Parameters\DNSRegisteredAdapters\{0751F0D9-4F38-4FCB-8EA8-2E05F05FC711}

and remove this entry. The moment I removed it from the registry, my issue was solved.

Note: If you are more careful it would be better to create a backup of your registry and/or create a restore point.

It seems that the adapter was an vmware adapter (I do have vmware installed), and for some reason it got corrupted. I didnt test vmware yet, so I dont know what the impact of this would be on vmware.

Probably another solution would be to uninstall vmware.

Friday, September 4, 2009

Enlarge input width size in edit/new pages

When editing list items in SharePoint, one of the most irritating issues I find is the width of the input fields, in particular the rich-text editor. So I have decided to fix this.




First of all we need to go to the page and set it in edit mode, which can be done by using the ToolPaneView=2 querystring. (See SharePoint Kings for more info), eg:

.....your-sharepoint-list-url..../EditForm.aspx?ToolPaneView=2

Then add a Content Editor WebPart. Make sure it is hidden in the appearance.
Finally add the following code:

<script type="text/javascript" src="{url-to-jquery}/jquery.js" language="javascript"></script> 


<script type="text/javascript">
function docready() {
  $('.ms-formbody').css('width', '100%');
  $('.ms-long').css('width', '100%');
  $('.ms-rtelong').css('width', '100%'); 
  $('.ms-rtelonger').css('width', '100%'); 
  $('#onetIDListForm').css('width', '100%');
}

_spBodyOnLoadFunctionNames.push("docready");

</script> 

Your forms will now use the complete width of your window.

Update: 25 september - Added the rte-longer class for also resizing the rich-text boxes

Future of navigation: Augmented Navigation



For more information about augmented reality, see this presentation

Tuesday, August 4, 2009

Function reference calculated fields in Sharepoint

Some times you need a list of functions you can use in Sharepoint calculated fields. It seems that this is available in your local machine...just go to: C:\Program Files\Microsoft Office\Office12\1033\STSLIST.CHM (if you got Office/Access 2007 installed)



or if you need an online version: wssdemo

or on your local sharepoint server:

http://server-name/_layouts/help.aspx?lcid=1033&cid0=MS.OSS.manifest&tid=MS.OSS.CH10176029&sq=calculated%20column


Show the year/week in Sharepoint

In order to group per week in a Sharepoint list, I have used the following function:

=IF([Completed date];YEAR([Completed date])&"/"&IF((INT(([Completed date]-DATE(YEAR([Completed date]);1;1)+(TEXT(WEEKDAY(DATE(YEAR([Completed date]);1;1));"d")))/7)+1)>10;INT(([Completed date]-DATE(YEAR([Completed date]);1;1)+(TEXT(WEEKDAY(DATE(YEAR([Completed date]);1;1));"d")))/7)+1;"0"&INT(([Completed date]-DATE(YEAR([Completed date]);1;1)+(TEXT(WEEKDAY(DATE(YEAR([Completed date]);1;1));"d")))/7)+1);"Uncompleted")

Actually the code to determine the weeknumber is:

=INT(([Completed date]-DATE(YEAR([Completed date]);1;1)+(TEXT(WEEKDAY(DATE(YEAR([Completed date]);1;1));"d")))/7)+1

So actually what I did was to first detect if the [Completed date] is valid (not empty), if it is it will show the text uncompleted. The next step was to check whether the week number is 2 digits if not then we will add an additional 0 to it, in order to make sure we can sort it correctly.

Modifying pages without the Edit page option in Sharepoint

Sometimes you want to customize a Sharepoint page, however the Edit Page item in the Site Actions Menu is not available. A good example for this is the Display and Edit page of a list item.

You can still do this by adding the ?ToolPaneView=2 parameter after the page url, eg. DispForm.aspx?ToolPaneView=2