Forum Discussion

Audi86's avatar
Audi86
Copper Contributor
Dec 08, 2022
Solved

Looking to add a line to check for existing email if already there

Hi, I have researched and came up this code to add email added in the access request field in SharePoint Subsites. I tested the script and its working fine. I am looking to modify this script to see...
  • AndySvints's avatar
    Dec 10, 2022

    Hello Audi86,

    You can get list of emails that are present there and if they are not empty set your email(s).

    Something like this: ( Add this code instead your line #19)

    $RequestAccessEmails=Get-PnPRequestAccessEmails
    if(!$RequestAccessEmails){
        Set-PnPRequestAccessEmails -Emails @("email address removed for privacy reasons")
    }

     Hope that helps.

     

Resources