Clearing SharePoint Designer 2013 Cache with PowerShell

If you’ve worked long enough with SharePoint Designer (SPD) 2013, then you’re probably aware of the constant need to clear cache.

Here’s a couple symptoms that you may run into with SPD caching issues:

  1. Error message: “Cannot perform this operation. The file is no longer checked out or has been deleted.”
     
  2. Published Workflow with conditions and transitions stripped/removed
    (if you invested time & sweat, this could look very daunting!!)
     

Clearing cache in SharePoint Designer is no rocket science. But it’s also not Ctrl+F5 that some of us have grown to love. Essentially, you have to delete all files in 2 local folders:

  • %APPDATA%\Microsoft\Web Server Extensions\Cache
  • %USERPROFILE%\AppData\Local\Microsoft\WebsiteCache

Just like rebooting any machine, once you clear cache, all most of your SPD problems disappear.

Now, my short term memory can be rather lousy … so I always have to dig up my notes to get these folder locations. This is why I love this handy dandy PowerShell script who does the clearing for me. The script is courtesy of my brilliant colleague, Matthew Bramer.

Remove-Item "$($env:APPDATA)\Microsoft\Web Server Extensions\Cache\*" -recurse -force
Remove-Item "$($env:USERPROFILE)\AppData\Local\Microsoft\WebsiteCache\*" -recurse -force

Save the script as a .ps1 file for future reference. When you run into a caching issue, make sure you close SharePoint Designer first. Then simply right click the ps1 script file and run with PowerShell. After that, you’re golden.

Side note: this should also work for SPD 2010 Cache. Though I have yet to confirm it.

Advertisements

One response to “Clearing SharePoint Designer 2013 Cache with PowerShell

  1. Thanks for the compliment Bobby! This script will work for 2010 as well.

    Cheers,
    Matthew

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s