Share via


Context.AddNotExpression Method

Adds an NOT aggregate context expression on the context.

Namespace:  Microsoft.SharePoint.Search.Extended.Administration.Keywords
Assembly:  Microsoft.SharePoint.Search.Extended.Administration (in Microsoft.SharePoint.Search.Extended.Administration.dll)

Syntax

'Declaration
Function AddNotExpression As AggregateContextExpression
'Usage
Dim instance As Context
Dim returnValue As AggregateContextExpression

returnValue = instance.AddNotExpression()
AggregateContextExpression AddNotExpression()

Return Value

Type: Microsoft.SharePoint.Search.Extended.Administration.Keywords.AggregateContextExpression
An AggregateContextExpression that represents the added NOT-expression.

Remarks

This method should be used to get a handle to the context expression. Subsequent expression nodes should be added to the handle returned by this call and not on the context. This method will overwrite any previous context expressions on the context.

Examples

This example shows how to add a not-expression

             //  The expression to be added is NOT(department="HR")
             
                 SearchSettingGroup group = ....... // use existing or create new 
                 Keyword keyword = group.Keywords.AddKeyword("language");
             
                 var employeeContext = group.Contexts.AddContext("employee");
                 var employeeExpression = employeeContext.AddNotExpression();
                 employeeExpression.AddMatchExpression("department", "HR");
                 keyword.AddSynonym("C#",employeeContext); 
             

See Also

Reference

Context Interface

Context Members

Microsoft.SharePoint.Search.Extended.Administration.Keywords Namespace