Resolving Issue “Item is no longer available. It may have been deleted by another user. Click ‘OK’ to refresh the page.” with XSL Link

I recently came across an issue where a client of ours was using the “XSL Link” in the Miscellaneous section of a list view web part. What was happening was when the user clicked on the context menu of an item in the list, they would receive the following error message.

Item is no longer available. It may have been deleted by another user. Click ‘OK’ to refresh the page.

It turns out that the client was using a local site collection asset in the XSL Link. In other words, the path to the file was similar to “/SiteAssets/XSL/no-items.xsl“. Doing this can cause the error above.

To resolve this, you need to install the file on the SharePoint web server(s) in the LAYOUTS directory either in a WSP solution, or directly in the farm under the following;

    C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14TEMPLATELAYOUTS (for SharePoint 2010)

    OR C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions15TEMPLATELAYOUTS (for SharePoint 2013)

    Such as this below:

    

Then you’ll instead refer to the file more like this in the XSL Link instead “/_layouts/no-items.xsl“.

To assign the XSL Link on a list view web part, edit the web part.

Then set the XSL Link in the Miscellaneous section. Be sure to use the technique above and put the file in the farm so you can set the reference to the layouts directory (demonstrated below).