SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created sharepoint alerts programmatically. If I check 'manage my alerts' all values are correct such as "Weekly", "Friday", "6:00pm" then I add an item to the list and receive an alert email immediately.

  SPAlert alert = user.Alerts.Add();
  alert.AlertType = SPAlertType.List;
  alert.list = myList;
  alert.AlertTemplate = myList.AlertTemplate;
  alert.User = user;
  alert.EventType = SPEventType.All;
  alert.DeliveryChannels =SPAlertDeliveryChannels.Email;

  // Set Time
  alert.AlertFrequency = SPAlertFrequency.Weekly;
  alert.AlertTime = new DateTime (2012,10,5,18,0,0);

I chose Oct 2012 bcause it has day values of 1=Monday - 5=Friday. I have also tried with April 2013. Still did not work

share|improve this question
up vote 0 down vote accepted

Try creating an alert manually that works like you want it to. Then fish out the properties with PowerShell (only with SP 2010 though)

$w = get-spweb
$w.alerts | ? {$_.User -eq "MyAccountName"}

I have a hunch that you will identify a difference in the alert made in the GUI and the one you are creating.

This is less of an answer than a route to troubleshoot, but it may give you ideas.

share|improve this answer
Than you, this allowed me to see that the is empty. Do you know why that is, or how I could get all property keys from the one in powershell? – user13186 Jan 25 '13 at 22:40
The only difference seems to be my = {}. But none of the properties that could be there effect frequency – user13186 Jan 26 '13 at 0:04
You may consider that the rule is actually working as intended. When you set the date and time for the first run, if it is in the past it will run immediately before setting the datetime for the next run. I recommend using an alternative formula that can calculate the correct date and time of the first run if you are trying to avoid an immediate run. – ghangas Jan 28 '13 at 18:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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