How can I "Enable reporting of offensive content" on community site Programmatically?

enter image description here

1 Answer 1


You can enable / disable reporting via the EnableDisableAbuseReports method of the internal class Microsoft.SharePoint.Portal.FunctionalityEnablers. The value of the vti_CommunityEnableReportAbuse web property has effect only to the value of the Enable reporting of offensive content checkbox on Site Settings / Community Settings page

Here is a sample implementation in PowerShell that performs both steps you need:

$web = Get-SPWeb http://YourSite/YourCommunityWeb

# this command has only effect on the check box in the UI
$web.AllProperties["vti_CommunityEnableReportAbuse"] = "true"

# the real job is done here
# 'System.Management.Automation.PSObject' cannot be converted to type 'Microsoft.SharePoint.SPWeb'
$spWeb = $web.Site.AllWebs[$web.ID]

# get a reference for the Microsoft.SharePoint.Portal assembly
$spPortalAssembly = [AppDomain]::CurrentDomain.GetAssemblies() | ? { $_.Location -ne $Null -And $_.Location.Split('\\')[-1].Equals('Microsoft.SharePoint.Portal.dll') }
# get the type 'Microsoft.SharePoint.Portal.FunctionalityEnablers'
$functionalityEnablersType = $spPortalAssembly.GetType("Microsoft.SharePoint.Portal.FunctionalityEnablers")
# get the method info for 'EnableDisableAbuseReports'
$mi_EnableDisableAbuseReports = $functionalityEnablersType.GetMethod("EnableDisableAbuseReports")
# invoke the static 'EnableDisableAbuseReports' method
$mi_EnableDisableAbuseReports.Invoke($null, @($spWeb, $True))

If you need it in C# (add Microsoft.SharePoint.Portal to the referneced assemblies in your project, and you need using System.Reflection; as well):

web.AllProperties["vti_CommunityEnableReportAbuse"] = "true";

// get an assembly refernce to "Microsoft.SharePoint.Portal" via an arbitrary public class from the assembly
Assembly spPortalAssembly = typeof(Microsoft.SharePoint.Portal.PortalContext).Assembly;

Type functionalityEnablersType = spPortalAssembly.GetType("Microsoft.SharePoint.Portal.FunctionalityEnablers");
MethodInfo mi_EnableDisableAbuseReports = functionalityEnablersType.GetMethod("EnableDisableAbuseReports");
mi_EnableDisableAbuseReports.Invoke(null, new object[] { web, true });
  • thank you, I tried you code using SP server c# code, but I can't find the "FunctionalityEnablers" under Microsoft.SharePoint.Portal
    – jobin
    Feb 19, 2015 at 7:23
  • As I wrote, it is internal, non-public, non-documented. You can find it using tools like Reflector or JetBrains dotPeek, or via the classes in the System.Reflection namespace. You can of course access the internal classes from C# as well, but it requires you to use Reflection as well.
    – pholpar
    Feb 19, 2015 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.