SPAlert.Filter - Operator Unknow RRS feed

  • Question

  • Hi,

    I create a custom SPAlert with a select multiple option.

    For apply a Filter, i will use the CAML clause "<In>", but i have the error : "Unknow Operator".

    .cs :

    using (SPSite site = new SPSite(SPContext.Current.Web.Url))


                    using (SPWeb spWeb = site.OpenWeb())


                        bool initialValue = spWeb.AllowUnsafeUpdates;

                        spWeb.AllowUnsafeUpdates = true;

                        SPAlert alert = spWeb.Alerts.Add();

                        alert.AlertType = SPAlertType.List;

                        alert.List = spWeb.Lists.TryGetList(ListTitle.PublishedPUB);

                        alert.Title = subscription.TitleAlert;

                        alert.DeliveryChannels = SPAlertDeliveryChannels.Email;

                        alert.User = spWeb.Site.RootWeb.CurrentUser;

                        DefineChangeType(subscription.ChangeType, alert); // Type de modification*/

                        DefinePeriodAlert(subscription.PeriodAlerts, subscription.Day, subscription.Hour, alert);

                        alert.Filter = DefineQuery(subscription, subscription.WhenAlerts);


                        spWeb.AllowUnsafeUpdates = initialValue;



    CAML :




                   <FieldRef LookupId="True" Name="TechnicalDomain"/>


                        <Value Type="Lookup">18</Value>

                        <Value Type="Lookup">19</Value>





    Error : 

    "The alert cannot be saved. Unknown operator present in the filter."

    Can you help me please ?

    Monday, February 13, 2017 12:44 PM

All replies

  • Hi Tony,

    The CAML Query to filter the multiple value in lookup field should be valid, but please check the event type, it will lead to this issue, please check the similiar thread:

    SPAlert.Filter not working


    Best Regards

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    Monday, February 20, 2017 8:16 AM