Expand Minimize

Declare property 'AllowClose' in WebPart to prevent closing of webpart by the user

A WebPart should contain the attribute 'AllowClose' with value False to prevent that users close the webpart. In this case the webpart would be disappear from the UI but will remain inside the page.

CheckId SPC056401
TypeName DeclareAllowCloseInWebPart
Severity CriticalWarning
Type WebPart

The Webpart should have property 'AllowClose' in the .webpart file. See sample below:

   <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
         <type name="TypeName, Version=VersionNumber, Culture=neutral, PublicKeyToken=PublicKeyToken" />  
         <importErrorMessage>Cannot import this Web Part.</importErrorMessage>  
            <property name="Title" type="string">WebPartTitle</property>
            <property name="Description" type="string">WebPartDescription</property>
            <property name="AllowClose" type="bool">False</property>

Disclaimer: The views and opinions expressed in this documentation and in SPCAF do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. SPCAF and RENCORE are registered trademarks of Rencore. All other trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners.