Rob Ellis
Jun 07, 2017Bronze Contributor
Task list - setting EnableAssignToEmail using PnP powershell - not working consistently
Using the following powershell:
$csvFile = ".\SiteIDs.csv" $sites = Import-Csv $csvfile Connect-SPOnline -Url https://<tenantname>.sharepoint.com -Credentials <creds> foreach ($site in $sites) { $web = Get-PnPWeb -Identity $site.siteid write-host $web.Title $List = Get-PnPList -Web $web -Identity Tasks $list.EnableAssignToEmail = $true $list.Update() }
In some cases the property is showing as True if I enter
$list.EnableAssignToEmail
but looking in the GUI, it shows as Disabled in the majority of cases - even having left it overnight to see if it was just a display issue.
On a single test list it seemed to take a number of attempts to get the property to show as True in Powershell (was showing blank).
Any ideas? Am I doing something fundamentally wrong?
Try the below script.
$csvFile = ".\SiteIDs.csv" $sites = Import-Csv $csvfile $cred=Get-Credential foreach ($site in $sites) { Connect-PnPOnline -Url $site.URl -Credentials $cred $ctx=Get-PnPContext $List = Get-PnPList -Identity Tasks $list.EnableAssignToEmail = $true $list.Update() $ctx.load($list) $ctx.executeQuery() }