Oct 25 2019 08:34 AM
Updating an alert does not save the alert properties field. The title gets updated but anything in the properties field does not get updated. (e.g. https://gallery.technet.microsoft.com/ScriptCenter/877d2abd-fce9-4545-b223-7637936dd888/)
Is this a bug or I'm not using the Properties field correctly.
User currentUser = context.Web.EnsureUser(options.UserName);
context.Load(currentUser);
Microsoft.SharePoint.Client.Alert alert = currentUser.Alerts.GetById(Guid.Parse("#ALERTGUID#"));
context.Load(alert,
list => list.Title,
list => list.ListID,
list => list.ItemID,
List => List.AlertType,
List => List.AlwaysNotify,
List => List.DeliveryChannels,
List => List.Status,
List => List.Filter,
List => List.AlertFrequency,
List => List.EventType,
List => List.Properties,
List => List.AllProperties
);
context.ExecuteQuery();
if (alert != null)
{
alert.Title = string.Format("Updated - {0}", DateTime.Now);
Console.WriteLine(alert.Properties["filterindex"]);
alert.Filter = string.Format(someoneElseChangeItemTemplate, "<Query><Neq><Value type=\"string\">#USERNAME#</Value><FieldRef Name=\"Editor/New\"/></Neq></Query>");
alert.Properties["filterindex"] = "1";
alert.Properties["eventtypeindex"] = "0";
alert.UpdateAlert();
context.Load(alert);
context.ExecuteQuery();
Console.WriteLine(alert.Properties["filterindex"]);