Question

Tell me, is there a SharePoint calendar with normal events, how to implement it so that when a date or date + time arrives in the calendar, would the email be sent to the user?

enter image description here

Était-ce utile?

La solution

You can achieve it by creating SharePoint designer workflow, using Pause until Date action.

enter image description here

Set Start workflow automatically when an item is created/changed:

enter image description here

Autres conseils

The solution is possible in 2 ways, code C# (Custom Timer Job) or Powershell. I did through Powershell and create New Event Windows Task scheduler, repeate task every 5 minutes:

if(!(Get-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction:SilentlyContinue)) { 
Add-PsSnapin Microsoft.SharePoint.PowerShell 
} 
$web = Get-SPWeb http://sps/sites/test
$list = $web.Lists["Calendar"]
$items = $list.items 
foreach($item in $items) {
if($item["EventDate"] -ne "") {
$CurrentDate = (Get-Date)
$StartDate = $item["EventDate"]
$EndDate = $item["EndDate"]
if(($StartDate -le $CurrentDate) -and ($EndDate -ge $CurrentDate) -and ($item["Trigger"] -ne "Yes")) {
$Author = New-Object Microsoft.SharePoint.SPFieldUserValue($web, $item["User"])
$CUserEmail = $Author.user.Email
$Server = "mail.server.com"
$From = "sps@mail.server.com"
$To = $CUserEmail
$Subject = $item["Title"]
$Body =  "<html><body><p><b>Date Start: </b>" +  $item["EventDate"].ToString("dd.MM.yyyy HH:mm") + "<p><b>Date End: </b>" +  $item["EndDate"].ToString('dd.MM.yyyy HH:mm') + "<p><a href='http://sps/sites/test/_layouts/15/start.aspx#/Lists/List/calendar.aspx'>Event reference in calendar</a>" + "</body></html>"
$SmtpClient = New-Object System.Net.Mail.SmtpClient
$Message = New-Object System.Net.Mail.MailMessage
$SmtpClient.Host = $Server
$Message.IsBodyHtml = $True
$Message.From = $From
$Message.To.Add($To)
$Message.Subject = $Subject
$Message.Body = $Body
$SmtpClient.Send($Message)
$Message.Dispose()
$item["Trigger"] = "Yes"
$item.Update();
} else {
Write-Host "False"
}
}
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top