Articles about European Sharepoint Hosting Service
European SharePoint 2010 Hosting :: How to Create Alerts in SharePoint 2010 Using PowerShell
Today, I will show you how to configure alerts using Powershell. In this article we will be seeing how to create an alert for a particular user subscribed for a document library using powershell.
Here are the steps:
1. Go to Start => All Programs => Microsoft SharePoint 2010 products => SharePoint 2010 Management Shell.
2. Run as an administrator.
3. Run the following script.
$site = Get-SPSite “http://serverName:22222/sites/TestSite/”
$web=$site.Rootweb
$list=$web.Lists.TryGetList(“Shared Documents”)
$user = $web.EnsureUser(‘domainName\userName’)
$newAlert = $user.Alerts.Add()
$newAlert.Title = “My Custom Alert”
$newAlert.AlertType=[Microsoft.SharePoint.SPAlertType]::List
$newAlert.List = $list
$newAlert.DeliveryChannels = [Microsoft.SharePoint.SPAlertDeliveryChannels]::Email
$newAlert.EventType = [Microsoft.SharePoint.SPEventType]::Add
$newAlert.AlertFrequency = [Microsoft.SharePoint.SPAlertFrequency]::Immediate
$newAlert.Update()
4. Go to Site Actions => Site Settings =>Site Administration => User Alerts.
5. Select the user from the drop down to show all the alerts created by that user and click on “Update”.
6. A new alert is created successfully using SharePoint object model.
7. An alternative method to check the newly created alert is to go to the Shared Documents (I have mentioned to create an alert for Shared Documents in my code) => in the ribbon interface, select Library Tools => Library => Alert Me.
8. Click on “Manage my alerts”.
9. Done. Here is the image that you should be able to see
Print article | This entry was posted by Derek Bierhoff on September 13, 2011 at 4:02 am, and is filed under European Sharepoint Hosting. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |