Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $recipients = "<user1@company.com>", "<group1@company.com>", "<group2@company.com>"
- #below try/catch lines are just to make sure the list exists, you don't actually need it!
- Add-PSSnapin Microsoft.SharePoint.PowerShell -EA 0
- try
- {
- $web = Get-SPWeb http://spwebapp1/sites/team
- $list = $web.GetListFromUrl("http://spwebapp1/sites/team/Lists/List1/AllItems.aspx")
- $fullUrl = $web.Site.Url + $list.DefaultViewUrl.Remove(0,1)
- }
- catch{
- Write-Host "it broke!"
- return
- }
- #Or you could just set $fullUrl to a static string
- $fullUrl = "http://spwebapp1/sites/team/Lists/List1/AllItems.aspx"
- #And this sends out the mail to the specified SmtpServer
- Send-MailMessage -From "sharepoint@company.com" -To $recipients -Subject "Happy Monday!" -BodyAsHtml "Here's a <a href='$($fullUrl)'>link!</a>" -SmtpServer mail.company.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement