Forum Discussion
Audi86
Dec 08, 2022Copper Contributor
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...
- 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.
AndySvints
Dec 10, 2022Steel Contributor
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.
Audi86
Dec 13, 2022Copper Contributor
hi AndySvints thanks for response. this is working. 🙂