I'm having problems creating an Alert for the current user programmatically for a GET request. No matter how I try to do it, it says updates are not allowed for GET requests.
var spContext = SPContext.Current; var web = spContext.Web; web.AllowUnsafeUpdates = true; var user = web.CurrentUser; var alert = user.Alerts.Add(); alert.Title = spContext.ListItem.Title; alert.AlertType = SPAlertType.Item; alert.Item = spContext.ListItem; alert.EventType = SPEventType.All; alert.Update(false); // error here
SPSecurity.RunWithElevatedPrivileges as well, after fetching the
SPUser, but the result is the same. I've had great success with
web.AllowUnsafeUpdates = true in other places.
Am I perhaps allowing unsafe updates on the wrong