I'm attempting to create an alert via code such that it triggers only when a document is published. I have used the following with no success.
SPAlert
alert = currUser.Alerts.Add();
alert.Filter ="<Query><Eq><FieldRef Name=\"vti_level\"/><Value type=\"integer\">1</Value></Eq></Query>";
alert.Title = "Test Alert '" + selectedFileName + "'" ;
alert.AlertType = SPAlertType.Item;
alert.EventType = SPEventType.All;
alert.Item = selectedFileListItem;
alert.AlertFrequency = SPAlertFrequency.Immediate;
alert.AlwaysNotify = true;
alert.Update(true);