Hello,
By default the change access request email is set to someone@example.com
We want to change that to our own email, for obvious reasons. So we use this piece of powershell:
$webapp = Get-SPWebApplication "http://sharepointtest"
$currentEmail = "someone@example.com";
$newEmail = "it-sharepoint_message@ourdomain.com";
foreach($site in $webapp.Sites)
{
foreach($web in $site.AllWebs)
{
$url = $web.url
Write-host $url
if (!$web.HasUniquePerm)
{
Write-Host "Access Request Settings is inherted from parent."
}
elseif($web.RequestAccessEnabled)
{
Write-Host "Access Request Settings is enabled."
write-host $web.RequestAccessEmail
if ($web.RequestAccessEmail -eq $currentEmail)
{
Write-Host "Email needs to be updated."
$web.RequestAccessEmail = $newEmail
$web.Update()
Write-Host "Email changed successfully!"
}
}
else
{
Write-Host "Access Request Settings not enabled."
}
}
}However in order for this to work... under our web application, SharePoint - 80 under user permissions we have to have "Manage Permissions" (under site permissions) checked. However in our environment we DO NOT want that checked! Without this step power shell errors with access denied.
Unless there is an easier way of doing this what I would like to do is automate the checking of that box to go before my script and the unchecking of that box after the above script runs. However I do not possess the knowledge to do that.
Requesting help, if someone knows the code? OR an alternative easier way of changing the default email.