SharePoint 2010: Set SPWeb.RequestAccessEmail via EcmaScript
I have a custom ribbon button which creates a Site Group with a predefined set of permissions. This is all done using EcmaScript and so far is working 100%.
The only settings I can't seem to initialise on the new Site Group using EcmaScript ar开发者_运维问答e those relating to membership requests (i.e. SPWeb.RequestAccessEmail)
Does anyone know how to set this property using the client object model?
I do not see it listed in the SP.Web Properties. Here is the definition of the SPWeb.RequestAccessEmail setter from Reflector:
if (!this.Site.WebApplication.RequestAccessEnabled)
{
throw new NotSupportedException(SPResource.GetString("EmailServiceNotConfigured", new object[0]));
}
if (SPWebService.ContentService.CreateActiveDirectoryAccounts)
{
throw new NotSupportedException(SPResource.GetString("RequestAccessNotAllowedOnVirtualServer", new object[0]));
}
if (!this.HasUniqueRoleAssignments)
{
throw new SPException(SPResource.GetString("RequestAccessUniqueWebs", new object[0]));
}
SPGlobal.FilterNullSize(value, 0xff, "RequestAccessEmail");
this.Request.SetRequestAccessInfo(this.Url, null, 0, true, value.Trim());
I don't think you will be able to duplicate this functionality using the ECMAScript object model.
You can use PowerShell to set the SPWeb.RequestAccessEmail to an empty string, which has the same effect as setting SPWeb.RequestAccessEnabled to false.
精彩评论