SOLVED

Wrong mail address in Access Request Settings

Steel Contributor

In SharePoint sites you have the option to define an email address in the Access Request options. The option is always enabled by default. Unfortunately with the static address someone@example.com. I verified the wrong mail address in normal SharePoint sites and personal sites (OneDrive for Business).

 

08-09-_2016_15-51-44.png

 

 

 

 

 

 

 

 

 

In modern team sites I don't know, the menu is not available.

 

  1. I assume it's not just "our issue". I verified the situation in 3 other tenants. I think it's a bug and the address should be renamed, for instance to the first site admin of the site.  Where should I report that issue?
  2. I found no property in the SharePoint Online Powershell cmdlets to modify that option. In SharePoint On-premise it's the property RequestAccessEmail, see https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.requestaccessemail.aspx. That property is not available in SPO cmdlets. How can we modify the address without an user interaction?
  3. Is it fixed in the modern team sites?

Regards

Tobias

6 Replies

I use CSOM to do that:

Web rootweb = ctx.Site.RootWeb;
ctx.Load(rootweb, w => w.MembersCanShare);
ctx.ExecuteQueryRetry();
SharingConfiguration sharingSettings = configurationData.ToConfigObject<SharingConfiguration>();
// Set MembersCanShare, default to false
rootweb.MembersCanShare = sharingSettings.Sharing.MembersCanShare ? sharingSettings.Sharing.MembersCanShare : false;
rootweb.Update();
ctx.Load(rootweb, w => w.AssociatedMemberGroup.AllowMembersEditMembership);
ctx.ExecuteQueryRetry();
// Set AllowMembersEditMembership, default to false
rootweb.AssociatedMemberGroup.AllowMembersEditMembership = sharingSettings.Sharing.AllowMembersEditMembership ? sharingSettings.Sharing.AllowMembersEditMembership : false;
rootweb.AssociatedMemberGroup.Update();
ctx.ExecuteQueryRetry();
ctx.Load(rootweb, w => w.RequestAccessEmail);
ctx.ExecuteQueryRetry();
rootweb.RequestAccessEmail = sharingSettings.Sharing.RequestAccessEmail;
rootweb.Update();
ctx.ExecuteQueryRetry();

 

I have seen the same issue with a few other clients as well that is why i provision them direct with above code.

 

kr

 

Paul

 

best response confirmed by TobiasAT (Steel Contributor)
Solution

RequestAccessEmail property is supported in SharePoint Online. You can use the below PowerShell script to set the RequestAccessEmail. 

 

$SiteUrl = "https://<TenantName>.sharepoint.com/sites/<Sitename>" 
$UserName = "admin@<TenantName>..onmicrosoft.com" 
$Password ="password"
$loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
$loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
$loadInfo3 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.UserProfiles")
#$sstr = ConvertTo-SecureString -string $AdminPass -AsPlainText -Force
$Securepass = ConvertTo-SecureString $Password -AsPlainText -Force
$context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,$Securepass)
$Web = $context.Web
$AllProperties=$Web.AllProperties
$context.Load($Web)
$context.Load($AllProperties)
$context.ExecuteQuery()
$Web.RequestAccessEmail="alexd@<TenantName>.onmicrosoft.com"
$web.Update();
$web.Context.ExecuteQuery()

 

Thanks for the hint, works as it should.

The last days the property RequestAccessEmail was available and I could change the mail address. Since today I get always an error "Property 'RequestAccessEmail' cannot be found on this object; make sure it exists and is settable.". The property is not longer listed in the members. Can someone verify the issue, or is it just on my side?

I have tried this in 2 tenants and it worked fine. Not sure what the problem may be. Can you able to perform this from this from Site Settings UI as in your screenshot?

Ok, found it. I used an old Microsoft.SharePoint.Client assembly, from version 15. The property RequestAccessEmail was added in CSOM version 16, see http://dev.office.com/blogs/new-sharepoint-csom-version-released-for-Office-365. I replaced the old assemblies with the DLLs from the SharePoint 2016 SDK. Now the property is visible. 

 

1 best response

Accepted Solutions
best response confirmed by TobiasAT (Steel Contributor)
Solution

RequestAccessEmail property is supported in SharePoint Online. You can use the below PowerShell script to set the RequestAccessEmail. 

 

$SiteUrl = "https://<TenantName>.sharepoint.com/sites/<Sitename>" 
$UserName = "admin@<TenantName>..onmicrosoft.com" 
$Password ="password"
$loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
$loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
$loadInfo3 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.UserProfiles")
#$sstr = ConvertTo-SecureString -string $AdminPass -AsPlainText -Force
$Securepass = ConvertTo-SecureString $Password -AsPlainText -Force
$context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,$Securepass)
$Web = $context.Web
$AllProperties=$Web.AllProperties
$context.Load($Web)
$context.Load($AllProperties)
$context.ExecuteQuery()
$Web.RequestAccessEmail="alexd@<TenantName>.onmicrosoft.com"
$web.Update();
$web.Context.ExecuteQuery()

 

View solution in original post