I've done some searching and cannot find a solution anywhere. I'm creating community site collections via event receiver. I need to enable "Auto-approval for permission requests" on each site collection upon creation. I know that in the front end you go to "Site Settings -> Community Settings" and enable it there manually. I need to do this via code.

any help would be greatly appreciated.

1 Answer 1


I opened the page "CommunitySettings.aspx" I saw in which object references Microsoft.SharePoint.Portal -> CommunitySettingsPage with Reflector and then I saw the internal code.

See and use it :)

using (SPWeb resource_0 = resource_1.OpenWeb(web.ID))
        resource_0.AllowUnsafeUpdates = true;
        resource_0.AllProperties[(object) CommunitiesConstants.CommunityEstablishedDateKey] = (object) resource_0.RegionalSettings.TimeZone.LocalTimeToUTC(ctrl.SelectedDate);
        if (resource_0.IsRootWeb && this.CheckEnableAutoApproval.Enabled)
          resource_0.AllProperties[(object) CommunitiesConstants.CommunityEnableAutoApprovalKey] = (object) this.CheckEnableAutoApproval.Checked.ToString();
        if (resource_0.Features[CommunitiesConstants.AbuseReportsList_FeatureId] != null && this.CheckEnableReportAbuse.Checked != CommunityUtils.IsReportAbuseEnabled(resource_0))
          resource_0.AllProperties[(object) CommunitiesConstants.CommunityEnableReportAbuseKey] = (object) this.CheckEnableReportAbuse.Checked.ToString();
          FunctionalityEnablers.EnableDisableAbuseReports(resource_0, this.CheckEnableReportAbuse.Checked);

Look this:

resource_0.AllProperties[(object) CommunitiesConstants.CommunityEnableAutoApprovalKey] = (object) this.CheckEnableAutoApproval.Checked.ToString();
  • Enjoy! And let me know ;) Commented Jan 15, 2015 at 11:29
  • Your suggestion worked! :) had to make a few tweaks. Thanks alot
    – user18075
    Commented Jan 16, 2015 at 5:01

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.