Question

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.

Was it helpful?

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

OTHER TIPS

Go to Site Actions -> Edit Page You get all the web parts edited. Click on the "Edit" dropdown of the Web Part you want to disable and choose "Close".

The web part disappears, but don't fear! It's not gone for good!

To have it back:
-> click to Add a new Web Part -> Advanced Web Part Gallery and Options.
The very first option you have is to choose among "Closed Web Parts". When clicking on that link, you will have displayed a list of all the web parts you had closed. Just add the one you want back!

write code to set a value in property bag of the site, set the value through the code and in page lode of the web part check for the value of the property bag if set show the content else just skip. hope you understood if not let me know i will make it clear.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top