Search code examples
sharepointweb-parts

How do you disable a SharePoint webpart temporarily?


Can this be done by setting a property?

I'd prefer that approach then to remove all security before re-adding it. (As this may have other consequences.)

Another option I can think of is to replace the particular webpart dll with a temporary one, and restart the .net process, but that's not an approach I like at all.

What other options are there? AM I missing something obvious?

What i'm trying to do is find a way to disable a webpart while we update the underlying database schema it's using, for example. So we'd ideally like to disable a specific webpart for all users, whether it's on a mysite, or a community site, make the required changes and then re-enable it. Thus decreasing the downtime for users.

Whatever the solution is, we need to be able to do it across multiple front end servers, on potentially two farms easily.

Thanks for your help.


Solution

  • In the web.config, you can set safe="false" for the SafeControl tag for the webpart. This will cause the web part to render an error message until you set it back to true.

    http://technet.microsoft.com/en-us/library/cc287909.aspx