SharePoint 2010: Usage files are not deleted, causing timer service problems.

On a SharePoint Server 2010 server, the Usage Provider (.usage) files are not deleted from the file system. Additionally, the .usage files keep growing.


The ULS logs are filled with the below errors :


Trace Management Service unable to delete file ‘D:\APPS\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS\IPW-SPWFE01-20160328-1257.usage’.  Error 00000020


To clear the old .usage files from the file system, I had to restart the SharePoint Timer Services. The .usage files were not getting automatically deleted and this is a known issue.


MS recommends the below action to fix this:

  1. Installing December 2013 CU for SharePoint 2010 (I would not recommend this )
  2. Set up a scheduled task to manually recycle the timer service (at least) once a day — every 4 to 6 hours would be better. 


You can use a PowerShell command like this to recycle the service:

restart-service -Name SPTimerV4


Then you just need to set up a scheduled task to run it every 6 hours on every SharePoint server in the farm.

When the timer service is manually recycled, the open handles to the .usage files are released, and they will be automatically deleted when the next instance of the Usage Data Import timer job runs (by default every 30 minutes).


There should be no need to manually delete the files or restart the services.



fix vertical scroll issues + SP 2010

var elmRibbon=GetCachedElement(“s4-ribbonrow”);

var elmWorkspace=GetCachedElement(“s4-workspace”);

var    vph=GetViewportHeight();

var newWorkspaceHeight=vph – elmRibbon.offsetHeight – AbsTop(elmRibbon);





Source –

Disable the recognition of mobile browsers

It can be done by adding the following snippet in thesystem.web section of the web.config of your Web Application:
    <result type="System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

CCS to hide borders around active web-parts.

.s4-wpActive .s4-wpTopTable {

SharePoint 2010: System.Security.Cryptography.CryptographicException – ERROR

SharePoint 2010 has a new feature which recycles the OWSTIMER.EXE process every night – similar to the application pool functionality in IIS – to avoid memory problems inside the timer service.

The recycling is controlled by a new timer job which has been added in SharePoint 2010: the “Timer Service Recycle” job which per default runs once a day at 6 AM.

While performing the recycling and shutting down the timer service the timer service runs into a problem in .NET which Tess Ferrandez has explained here.

The problem here is that the encryption key was created on a specific thread which was impersonated under a specific users account. When the .NET Finalizer processes the encryption key while the timer service shuts down it executed on a different thread which is not impersonated – so the key does not exist and you get an exception like “keyset does not exist”.

As this exception occurs in the final stages of the shutdown of the process it does not cause any harm – beside adding an event to the event log when it happens:


Eventlog Error

An unhandled exception occurred and the process was terminated.
Application ID: DefaultDomain
Process ID: 4213
Exception: System.Security.Cryptography.CryptographicException

Message: Keyset does not exist

StackTrace:    at System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr)
at System.Security.Cryptography.SafeProvHandle._FreeCSP(IntPtr pProvCtx)
at System.Security.Cryptography.SafeProvHandle.ReleaseHandle()
at System.Runtime.InteropServices.SafeHandle.InternalFinalize()
at System.Runtime.InteropServices.SafeHandle.Dispose(Boolean disposing)
at System.Runtime.InteropServices.SafeHandle.Finalize()

A more visible problem for a customer will occur when Visual Studio or a another JIT Debugger is installed on the affected box. In this case the following dialog will show up on the Console when the problem occurs:

Uninstalling Visual Studio will not resolve this issue as the registry settings which present this dialog are still active.

To configure the server to no longer show a dialog when an unhandled exception occurs, use the registry editor to delete the following registry keys:

  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\DbgManagedDebugger

On a 64-bit operating system also delete the following registry keys:

  • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger
  • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\DbgManagedDebugger

More details are at:

Pop Up in Modal SP Dialog

<a href=”javascript:OpenPopUpPage(‘/SitePages/yourpage.aspx’);”>What s NEW ?</a>

Open a new document from a word template for a SharePoint Document Library

Open a new document from a word template for a SharePoint Document Library, instead of opening the dotx file itself – as SP would normally do.
<script type="text/javascript" src="/_layouts/jquery.min.js"></script>
<script type="text/javascript">
$( function () {
$("a[href$='.dot'], a[href$='.dotx'], a[href$='.xlt'], a[href$='.xltx']").attr("onclick", "").click( function () {
saveLocation = $(this).attr("href").split("/").slice(0, -2).join("/")
createNewDocumentWithProgID(window.location.protocol + '//' + + $(this).attr("href"), window.location.protocol + '//' + + saveLocation, 'SharePoint.OpenDocuments', false)
return false
As always when we are working with jQuery you have to make sure that you reference the location of that .js-file
I got it from
 <script src="//"></script>