' Create the view object.
Dim oViewNew As New MFilesAPI.View
oViewNew.Name = "Test view"
' Create the search criteria for the view.
Dim oSc As New MFilesAPI.SearchCriteria
oSc.FullTextSearchString = "demo*"
oSc.FullTextSearchFlags = MFilesAPI.MFFullTextSearchFlags.MFFullTextSearchFlagsStemming Or _
MFilesAPI.MFFullTextSearchFlags.MFFullTextSearchFlagsLookInMetaData Or _
MFilesAPI.MFFullTextSearchFlags.MFFullTextSearchFlagsLookInFileData Or _
MFilesAPI.MFFullTextSearchFlags.MFFullTextSearchFlagsTypeAllWords
oSc.SearchFlags = MFilesAPI.MFSearchFlags.MFSearchFlagNone
oSc.ExpandUI = True
' Create the "not deleted" condition for search criteria.
Dim oExpression As New MFilesAPI.Expression
oExpression.DataStatusValueType = MFilesAPI.MFStatusType.MFStatusTypeDeleted
oExpression.DataStatusValueDataFunction = MFilesAPI.MFDataFunction.MFDataFunctionNoOp
Dim oTypedValue As New MFilesAPI.TypedValue
oTypedValue.SetValue(MFilesAPI.MFDataType.MFDatatypeBoolean, False)
Dim oDeletedEx As New MFilesAPI.SearchConditionEx
oDeletedEx.SearchCondition.Set(oExpression, MFilesAPI.MFConditionType.MFConditionTypeEqual, oTypedValue)
oDeletedEx.Enabled = True
oDeletedEx.Ignored = False
oDeletedEx.SpecialNULL = False
' Add the deleted condition.
oSc.AdditionalConditions.Add(-1, oDeletedEx)
' Add the new view.
oViewNew = oVault.ViewOperations.AddTemporarySearchView(oViewNew, oSc)