0

I have SharePoint document library with UAT date and Assign to , i want to send an email after every 80 days to Assign to user ,i am able to do this but now i want to send a consolidated email to Assign user with all item which is Assign to him and UAT date is after 80 days ,

Currently it send email for each item separate , but i want it in consolidated .

1 Answer 1

0

You can read all the list items assigned to particular users using the camel query and CSOM PowerShell script, then configure that PowerShell script in windows task schedular.

Refer to the below sample PowerShell script to send email from SharePoint online:

#variables region.
$siteURL="https://globalsharepoint.sharepoint.com/sites/TestSite/"
$spUserName="[email protected]"
$BCCUserName = "[email protected]"
$ccUserName = "[email protected]"
$toUserName = "[email protected]"
$emailBody = "Test email from SharePoint online CSOM PowerShell script." 
$password = "YourPassword"
#variables region end.
$securePassword= $Password | ConvertTo-SecureString -AsPlainText -Force
  
#Setup the Context
try
{
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteURL)
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($spUserName, $securePassword)  
$clientCSOMEMailProperties=New-Object Microsoft.SharePoint.Client.Utilities.EmailProperties        
$clientCSOMEMailProperties.BCC= [Collections.Generic.List[String]]@($BCCUserName) 
$clientCSOMEMailProperties.CC=[Collections.Generic.List[String]]@($CCUserName) 
$clientCSOMEMailProperties.To=[Collections.Generic.List[String]]@($ToUserName) 
$clientCSOMEMailProperties.From=$spUserName 
$clientCSOMEMailProperties.Body=$emailBody
$clientCSOMEMailProperties.Subject="Test email from SharePoint online CSOM PowerShell script." 
$csomUtility=[Microsoft.SharePoint.Client.Utilities.Utility]::SendEmail($ctx, $clientCSOMEMailProperties)        
$ctx.ExecuteQuery() 
$ctx.Dispose() 
}
catch 
{
  
    $errorMessage = $_.Exception.Message +"in sending email from CSOM SharePoint online";
    Write-Host $errorMessage -BackgroundColor Red
    Write-Log $errorMessage 
}         
Write-Host "##########################################################"
Write-Host "Test email from SharePoint online CSOM PowerShell script." -ForegroundColor Green 
Write-Host "##########################################################"

Reference:

SharePoint Online Automation – O365 – Send email from SharePoint online Using CSOM PowerShell script

3
  • Thank you for the response but is there any way to get in designer
    – kumar
    Commented Jun 22, 2020 at 9:52
  • PowerShell script task schedular is recommended one approach - in the designer workflow, you might add "Pause Until Date" action - the downfall of that approach is the first time you need trigger the workflow manually and it takes unwanted resources as this will be paused for 80 days in your scenario.
    – SP 2022
    Commented Jun 22, 2020 at 10:36
  • Reminder is working fine SharePoint designer I am just unable to consolidate them as one email for each users
    – kumar
    Commented Jun 22, 2020 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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