SharePoint Designer sometimes is out of sync with SharePoint. SharePoint Designer will incorrectly show items as checked out (or checked in) and refuses to be update with the actual status. In some cases the following error will be shown when trying to check out/in an item.
“Cannot perform this operation. The file is no longer checked out or has been deleted.”
Solution
The solution to this problem is to clear the cache of SharePoint Designer.
1. If opened close SharePoint Designer
2. Open the folder %APPDATA%MicrosoftWeb Server ExtensionsCache
3. Delete the contents
4. Open the folder %USERPROFILE%AppDataLocalMicrosoftWebsiteCache
5. Delete the contents
6. Problem solved.
Thank-you this can probably be automated with a PowerShell Script. Thanks for your good work in isolating this quirk. Don’t you think this might qualify to Microsoft as a bug fix with designer?
Stephan Onisick
It might qualify as a bug. But I don’t think this will be changed anytime soon. This behavior is very old and happens at least since SharePoint 2007.
Awesome Catch! Look forward to reading more from you.
Thanks, Stephan
Hi,
Did anyone create a powershell script for this? Just so I wont have to redo the work.
I did not create a script for this, not even sure if powershell can do this.
This should do the job, please test before use:
$spd = Get-Process spdesign -ErrorAction SilentlyContinue
If(!$spd){
$appdata = $env:APPDATA
$userprofile = $env:USERPROFILE
$webservext = $appdata + “MicrosoftWeb Server ExtensionsCache”
$webcache = $userprofile + “AppDataLocalMicrosoftWebsiteCache”
Write-Host “Clearing Web Server Extensions cache” -ForegroundColor Yellow
Remove-Item -Path $webservext -Recurse
Write-Host “Web Server Extensions cache cleared” -ForegroundColor Green
Write-Host “Clearing Web Site cache” -ForegroundColor Yellow
Remove-Item -Path $webcache -Exclude *.xml -Recurse
Write-Host “Web Site cache cleared” -ForegroundColor Green
}
else{
Write-Host “SharePoint Designer running, close and re-run” -ForegroundColor Magenta
}
Wow thanks! I will test this out asap.
By the way, the script as Simon added, works. I created a ps1 file which is being executed by a .bat file, right before I open sharepoint designer. Quite handy.
Also works if workflows suddenly become blank or empty which was what happened to me! Following the instructions in this post fixed the issue. Thank You !! ~B
To those asking about a Powershell script… The Batch script that was included is just fine as a stand-alone. Why complicate things? .bat files run against Explorer folders, not SharePoint, and .bat files can run without the overhead of PS just fine with a double-click, on any Windows platform. There’s no advantage to adding the extra PS layer to this. This is SP Designer’s cache, not SharePoint’s, so it’s not like you’ll need to be running this script in the middle of a SharePoint page load routine, or workflow or WSP deployment or something…. Maybe someone would like to inform me about the reasoning to go the extra mile?
And to Ben…. Many thanks for the script – it helped solve an issue where a file was checked out, we created a copy of it, discarded the check-out on the original, then in Explorer view, deleted the original and renamed the 2nd file the original’s name. SP Designer saw the file had the same name as the original and thought it was still checked out. The script solved the problem – thanks again, Ben.