none
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);

                        alert.Update(true);

                        spWeb.AllowUnsafeUpdates = initialValue;

                    }

                }

    CAML :

    <Query>

         <Where>

              <In>

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

                   <Values>

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

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

                   </Values>

             </In>

         </Where>

    </Query>

    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

    Thanks

    Best Regards


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

    Monday, February 20, 2017 8:16 AM