2

I am creating a script to check if the site has Request Access Enabled. this is a snippet of my script:

$ctx = GetClientContext $url $username $password;
$web = $ctx.Web
$ctx.Load($web)
$ctx.ExecuteQuery()

foreach($w in $web.Webs)
{

      Write-Host $w.Title " - " $w.Url " Access Request Email - " $w.RequestAccessEmail  -ForegroundColor Gray

}

it is not returning any value even though it is enabled, however, it does print if i set a value to it which i dont want to do. why is it not returning any value? Also, i am not finding RequestAccessEnabled command.

  • after setting the value, did you check it in the site, can you see the updated value? – Karthik Jaganathan Jun 30 '17 at 6:14
  • Hi @KarthikJaganathan , yes the site has a value but the script is giving me blank values. but when i try to set a value for the RequestAccessEmail, it works. not sure what im missing. – Page F.P.T Jun 30 '17 at 6:23
1

Had only SP on-premise to try how the script would work (ofc by adjusting it to server-hosted at first), and the email was returned successfully when it was set. This might be a current issue with SP Online, in which case you should target the question directly to Microsoft.

Also, RequestAccessEnabled is there, and it would return true, if request for access is enabled. (see: SPWeb.RequestAccessEnabled property.)

  • Hi @moe, i tried to debug the code but then there is no command for RequestAccessEnabled in the intellisense. – Page F.P.T Jun 30 '17 at 7:17
  • do you have to set a value before it can be returned by the script? – Page F.P.T Jun 30 '17 at 8:54
  • @PageF.P.T no, I was able to just do the Write-Host without setting anything. – moe Jun 30 '17 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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