C# Class GSoft.Dynamite.Caml.CamlBuilder

CAML query builder, replacing the use of John Holiday's this.NET library. (thanks John, it was nice while it lasted!)
Inheritance: ICamlBuilder
Mostrar archivo Open project: GSoft-SharePoint/Dynamite-2010

Public Methods

Method Description
And ( string leftCondition, string rightCondition ) : string

Creates CAML and with the specified left and right conditions.

BeginsWith ( string fieldRefElement, string valueElement ) : string

Creates CAML begins with with the specified field reference and value.

CalendarViewDateRangesOverlap ( string startDateFieldName, string endDateFieldName ) : string

Calendar view date ranges overlap.

CalendarViewDateRangesOverlap ( string startDateFieldName, string endDateFieldName, string period ) : string

Calendar view date ranges overlap.

CamlBuilder ( ITaxonomyService taxonomyService, ILogger logger ) : System

Initializes a new instance of the CamlBuilder class.

Contains ( string fieldRefElement, string valueElement ) : string

Creates CAML contains with the specified field reference and value.

DateRangesOverlap ( string fieldRefElement, string valueElement ) : string

Creates CAML date ranges overlap with the specified field reference and value.

Equal ( string leftCondition, string rightCondition ) : string

Creates CAML equal with the specified left and right conditions.

FieldRef ( string fieldName ) : string

Creates CAML field reference with the specified field name.

FieldRef ( string fieldName, CamlEnums sortType ) : string

Creates CAML field reference with the specified field name.

GreaterThan ( string leftCondition, string rightCondition ) : string

Creates CAML greater than with the specified left and right conditions.

GreaterThanOrEqual ( string leftCondition, string rightCondition ) : string

Creates CAML greater than or equal with the specified left and right conditions.

GroupBy ( string fieldRefElement ) : string

Creates CAML group by with the specified field reference.

GroupBy ( string fieldRefElement, bool collapse ) : string

Creates CAML group by with the specified field reference.

In ( string leftCondition, string rightCondition ) : string

Creates CAML equal with the specified left and right conditions.

IsAfterPublishingStartDate ( ) : string

Determines whether [is publishing started] based on today's date.

IsAfterPublishingStartDate ( System.DateTime startDateTime ) : string

Determines whether [is publishing started].

IsAfterPublishingStartDate ( bool includeTimeValue ) : string

Determines whether [is publishing started] based on today's date.

IsAfterPublishingStartDate ( int startOffsetDays ) : string

Determines whether [is publishing started] [the specified start date offset].

IsBeforePublishingExpiryDate ( ) : string

Determines whether [is publishing expired].

IsBeforePublishingExpiryDate ( System.DateTime expirationDateTime ) : string

Determines whether [is publishing expired].

IsBeforePublishingExpiryDate ( bool includeTimeValue ) : string

Determines whether [is publishing expired].

IsBeforePublishingExpiryDate ( int expirationOffsetDays ) : string

Determines whether [is publishing expired] [the specified expiration days offset].

IsContentType ( SPContentTypeId contentTypeId ) : string

Creates a CAML query to determine whether [is content type] [the specified content type identifier].

IsNotNull ( string fieldRefElement ) : string

Creates CAML is null by with the specified field reference.

IsNull ( string fieldRefElement ) : string

Creates CAML is null by with the specified field reference.

IsOrInheritsContentType ( SPContentTypeId contentTypeId ) : string

Creates a CAML query to determine whether [is or inherits content type] [the specified content type identifier].

IsPublished ( ) : string

Determines whether this instance is published.

IsPublished ( System.DateTime startDateTime, System.DateTime expirationDateTime ) : string

Determines whether this instance is published.

IsPublished ( bool includeTimeValue ) : string

Determines whether this instance is published.

IsPublished ( int startOffsetDays, int expirationOffsetDays ) : string

Determines whether this instance is published based on a specified start and end offset.

LesserThan ( string leftCondition, string rightCondition ) : string

Creates CAML lesser than by with the specified left and right conditions.

LesserThanOrEqual ( string leftCondition, string rightCondition ) : string

Creates CAML lesser than or equal by with the specified left and right conditions.

List ( System.Guid listId ) : string

Creates CAML lists by with the specified arguments.

Lists ( CamlEnums baseType, string listElements ) : string

Creates CAML lists by with the specified arguments.

Lists ( CamlEnums baseType, string listElements, string serverTemplate ) : string

Creates CAML lists by with the specified arguments.

Lists ( CamlEnums baseType, string listElements, string serverTemplate, bool includeHiddenLists ) : string

Creates CAML lists by with the specified arguments.

Lists ( CamlEnums baseType, string listElements, string serverTemplate, bool includeHiddenLists, int maxListLimit ) : string

Creates CAML lists by with the specified arguments.

Lists ( string listElements ) : string

Creates CAML lists by with the specified arguments.

Lists ( string listElements, bool includeHiddenLists ) : string

Creates CAML lists by with the specified arguments.

Lists ( string listElements, int maxListLimit ) : string

Creates CAML lists by with the specified arguments.

Lists ( string listElements, string serverTemplate, bool includeHiddenLists ) : string

Creates CAML lists by with the specified arguments.

Membership ( CamlEnums type ) : string

Creates CAML membership by with the specified membership type and value.

Membership ( CamlEnums type, string value ) : string

Creates CAML membership by with the specified membership type and value.

NotEqual ( string leftCondition, string rightCondition ) : string

Creates CAML not equal by with the specified left and right conditions.

Now ( ) : string

Return the now CAML value.

Or ( string leftCondition, string rightCondition ) : string

Creates CAML or by with the specified left and right conditions.

OrderBy ( ) : string

Creates CAML order by with the specified arguments.

OrderBy ( string fieldRefElements ) : string

Creates CAML order by with the specified field references.

ProjectProperty ( string propertyName ) : string

Creates CAML project property with the specified property name.

ProjectProperty ( string propertyName, string defaultValue ) : string

Creates CAML project property with the specified property name and default value.

ProjectProperty ( string propertyName, string defaultValue, CamlEnums autoHyperlinkType, bool autoNewLine, bool expandXml, bool htmlEncode, bool stripWhiteSpace, CamlEnums urlEncodingType ) : string

Creates CAML project property with the specified condition.

SafeIdentifier ( string identifier ) : string

Creates CAML safe identifier by with the specified identifier value.

TermFilter ( SPList list, string taxonomyFieldInternalName, Guid termId, bool includeDescendants ) : string

Generates a CAML filter for a Taxonomy Term in a global farm term store group

TermFilter ( SPList list, string taxonomyFieldInternalName, IList terms, bool includeDescendants ) : string

Generates a CAML filter for a Taxonomy Term

TermFilter ( SPList list, string taxonomyFieldInternalName, Term term, bool includeDescendants ) : string

Generates a CAML filter for a Taxonomy Term

TermFilter ( SPList list, string taxonomyFieldInternalName, string termSetName, string termLabel, bool includeDescendants ) : string

Generates a CAML filter for a Taxonomy Term from the site-collection-reserved term store group

TermFilter ( SPList list, string taxonomyFieldInternalName, string termStoreGroupName, string termSetName, string termLabel, bool includeDescendants ) : string

Generates a CAML filter for a Taxonomy Term in a global farm term store group

Today ( ) : string

Gets the today value tag.

Today ( bool includeTimeValue ) : string

Todays the specified include time value.

Today ( int offsetDays ) : string

Gets the today value tag.

Today ( int offsetDays, bool includeTimeValue ) : string

Todays the specified offset days.

Value ( DateTime fieldValue ) : string

Creates CAML value with the specified value.

Value ( DateTime fieldValue, bool includeTimeValue ) : string

Values the specified field value.

Value ( bool fieldValue ) : string

Creates CAML value with the specified value.

Value ( int fieldValue ) : string

Creates CAML value with the specified value.

Value ( string fieldValue ) : string

Creates CAML value with the specified value.

Value ( string valueType, string fieldValue ) : string

Creates CAML value with the specified type and value.

ViewFields ( ) : string

Creates CAML view fields with the specified fields.

ViewFieldsForEntityType ( Type entityType ) : string

Creates CAML view fields with the specified entity type.

Webs ( CamlEnums scope ) : string

Creates CAML webs with the specified scope.

Where ( string condition ) : string

Creates CAML where with the specified condition.

WithIndex ( Guid fieldId, string fieldValue ) : string

Creates CAML with index than with the specified field ID and value.

Xml ( string condition ) : string

Creates CAML XML with the specified condition.

Private Methods

Method Description
GetAllWssIdByTerm ( SPList list, Term term, bool includeDescendants ) : string
Tag ( string tag, string value ) : string
Tag ( string tag, string attribute, string attributeValue, string value ) : string

Method Details

And() public method

Creates CAML and with the specified left and right conditions.
public And ( string leftCondition, string rightCondition ) : string
leftCondition string The left condition.
rightCondition string The right condition.
return string

BeginsWith() public method

Creates CAML begins with with the specified field reference and value.
public BeginsWith ( string fieldRefElement, string valueElement ) : string
fieldRefElement string The field reference element.
valueElement string The value element.
return string

CalendarViewDateRangesOverlap() public method

Calendar view date ranges overlap.
public CalendarViewDateRangesOverlap ( string startDateFieldName, string endDateFieldName ) : string
startDateFieldName string The start date field name.
endDateFieldName string The end date field name.
return string

CalendarViewDateRangesOverlap() public method

Calendar view date ranges overlap.
public CalendarViewDateRangesOverlap ( string startDateFieldName, string endDateFieldName, string period ) : string
startDateFieldName string The start date field name.
endDateFieldName string The end date field name.
period string The period.
return string

CamlBuilder() public method

Initializes a new instance of the CamlBuilder class.
public CamlBuilder ( ITaxonomyService taxonomyService, ILogger logger ) : System
taxonomyService ITaxonomyService The taxonomy service.
logger ILogger The logger.
return System

Contains() public method

Creates CAML contains with the specified field reference and value.
public Contains ( string fieldRefElement, string valueElement ) : string
fieldRefElement string The field reference element.
valueElement string The value element.
return string

DateRangesOverlap() public method

Creates CAML date ranges overlap with the specified field reference and value.
public DateRangesOverlap ( string fieldRefElement, string valueElement ) : string
fieldRefElement string The field reference element.
valueElement string The value element.
return string

Equal() public method

Creates CAML equal with the specified left and right conditions.
public Equal ( string leftCondition, string rightCondition ) : string
leftCondition string The left condition.
rightCondition string The right condition.
return string

FieldRef() public method

Creates CAML field reference with the specified field name.
public FieldRef ( string fieldName ) : string
fieldName string Name of the field.
return string

FieldRef() public method

Creates CAML field reference with the specified field name.
public FieldRef ( string fieldName, CamlEnums sortType ) : string
fieldName string Name of the field.
sortType CamlEnums Type of the sort.
return string

GreaterThan() public method

Creates CAML greater than with the specified left and right conditions.
public GreaterThan ( string leftCondition, string rightCondition ) : string
leftCondition string The left condition.
rightCondition string The right condition.
return string

GreaterThanOrEqual() public method

Creates CAML greater than or equal with the specified left and right conditions.
public GreaterThanOrEqual ( string leftCondition, string rightCondition ) : string
leftCondition string The left condition.
rightCondition string The right condition.
return string

GroupBy() public method

Creates CAML group by with the specified field reference.
public GroupBy ( string fieldRefElement ) : string
fieldRefElement string The field reference element.
return string

GroupBy() public method

Creates CAML group by with the specified field reference.
public GroupBy ( string fieldRefElement, bool collapse ) : string
fieldRefElement string The field reference element.
collapse bool if set to true [collapse].
return string

In() public method

Creates CAML equal with the specified left and right conditions.
public In ( string leftCondition, string rightCondition ) : string
leftCondition string The left condition.
rightCondition string The right condition.
return string

IsAfterPublishingStartDate() public method

Determines whether [is publishing started] based on today's date.
public IsAfterPublishingStartDate ( ) : string
return string

IsAfterPublishingStartDate() public method

Determines whether [is publishing started].
public IsAfterPublishingStartDate ( System.DateTime startDateTime ) : string
startDateTime System.DateTime The start date time.
return string

IsAfterPublishingStartDate() public method

Determines whether [is publishing started] based on today's date.
public IsAfterPublishingStartDate ( bool includeTimeValue ) : string
includeTimeValue bool if set to true [include time value].
return string

IsAfterPublishingStartDate() public method

Determines whether [is publishing started] [the specified start date offset].
public IsAfterPublishingStartDate ( int startOffsetDays ) : string
startOffsetDays int The number of offset days from today for the starting date.
return string

IsBeforePublishingExpiryDate() public method

Determines whether [is publishing expired].
public IsBeforePublishingExpiryDate ( ) : string
return string

IsBeforePublishingExpiryDate() public method

Determines whether [is publishing expired].
public IsBeforePublishingExpiryDate ( System.DateTime expirationDateTime ) : string
expirationDateTime System.DateTime The expiration date time.
return string

IsBeforePublishingExpiryDate() public method

Determines whether [is publishing expired].
public IsBeforePublishingExpiryDate ( bool includeTimeValue ) : string
includeTimeValue bool if set to true [include time value].
return string

IsBeforePublishingExpiryDate() public method

Determines whether [is publishing expired] [the specified expiration days offset].
public IsBeforePublishingExpiryDate ( int expirationOffsetDays ) : string
expirationOffsetDays int The number of offset days from today for the expiration date.
return string

IsContentType() public method

Creates a CAML query to determine whether [is content type] [the specified content type identifier].
public IsContentType ( SPContentTypeId contentTypeId ) : string
contentTypeId SPContentTypeId The content type identifier.
return string

IsNotNull() public method

Creates CAML is null by with the specified field reference.
public IsNotNull ( string fieldRefElement ) : string
fieldRefElement string The field reference element.
return string

IsNull() public method

Creates CAML is null by with the specified field reference.
public IsNull ( string fieldRefElement ) : string
fieldRefElement string The field reference element.
return string

IsOrInheritsContentType() public method

Creates a CAML query to determine whether [is or inherits content type] [the specified content type identifier].
public IsOrInheritsContentType ( SPContentTypeId contentTypeId ) : string
contentTypeId SPContentTypeId The content type identifier.
return string

IsPublished() public method

Determines whether this instance is published.
public IsPublished ( ) : string
return string

IsPublished() public method

Determines whether this instance is published.
public IsPublished ( System.DateTime startDateTime, System.DateTime expirationDateTime ) : string
startDateTime System.DateTime The start date time.
expirationDateTime System.DateTime The expiration date time.
return string

IsPublished() public method

Determines whether this instance is published.
public IsPublished ( bool includeTimeValue ) : string
includeTimeValue bool if set to true [include time value].
return string

IsPublished() public method

Determines whether this instance is published based on a specified start and end offset.
public IsPublished ( int startOffsetDays, int expirationOffsetDays ) : string
startOffsetDays int The number of offset days from today for the starting date.
expirationOffsetDays int The number of offset days from today for the expiration date.
return string

LesserThan() public method

Creates CAML lesser than by with the specified left and right conditions.
public LesserThan ( string leftCondition, string rightCondition ) : string
leftCondition string The left condition.
rightCondition string The right condition.
return string

LesserThanOrEqual() public method

Creates CAML lesser than or equal by with the specified left and right conditions.
public LesserThanOrEqual ( string leftCondition, string rightCondition ) : string
leftCondition string The left condition.
rightCondition string The right condition.
return string

List() public method

Creates CAML lists by with the specified arguments.
public List ( System.Guid listId ) : string
listId System.Guid The list identifier.
return string

Lists() public method

Creates CAML lists by with the specified arguments.
public Lists ( CamlEnums baseType, string listElements ) : string
baseType CamlEnums Type of the base.
listElements string The list elements.
return string

Lists() public method

Creates CAML lists by with the specified arguments.
public Lists ( CamlEnums baseType, string listElements, string serverTemplate ) : string
baseType CamlEnums Type of the base.
listElements string The list elements.
serverTemplate string The server template.
return string

Lists() public method

Creates CAML lists by with the specified arguments.
public Lists ( CamlEnums baseType, string listElements, string serverTemplate, bool includeHiddenLists ) : string
baseType CamlEnums Type of the base.
listElements string The list elements.
serverTemplate string The server template.
includeHiddenLists bool if set to true [include hidden lists].
return string

Lists() public method

Creates CAML lists by with the specified arguments.
public Lists ( CamlEnums baseType, string listElements, string serverTemplate, bool includeHiddenLists, int maxListLimit ) : string
baseType CamlEnums Type of the base.
listElements string The list elements.
serverTemplate string The server template.
includeHiddenLists bool if set to true [include hidden lists].
maxListLimit int The maximum list limit.
return string

Lists() public method

Creates CAML lists by with the specified arguments.
public Lists ( string listElements ) : string
listElements string The list elements.
return string

Lists() public method

Creates CAML lists by with the specified arguments.
public Lists ( string listElements, bool includeHiddenLists ) : string
listElements string The list elements.
includeHiddenLists bool if set to true [include hidden lists].
return string

Lists() public method

Creates CAML lists by with the specified arguments.
public Lists ( string listElements, int maxListLimit ) : string
listElements string The list elements.
maxListLimit int The maximum list limit.
return string

Lists() public method

Creates CAML lists by with the specified arguments.
public Lists ( string listElements, string serverTemplate, bool includeHiddenLists ) : string
listElements string The list elements.
serverTemplate string The server template.
includeHiddenLists bool if set to true [include hidden lists].
return string

Membership() public method

Creates CAML membership by with the specified membership type and value.
public Membership ( CamlEnums type ) : string
type CamlEnums The membership type.
return string

Membership() public method

Creates CAML membership by with the specified membership type and value.
public Membership ( CamlEnums type, string value ) : string
type CamlEnums The membership type.
value string The value.
return string

NotEqual() public method

Creates CAML not equal by with the specified left and right conditions.
public NotEqual ( string leftCondition, string rightCondition ) : string
leftCondition string The left condition.
rightCondition string The right condition.
return string

Now() public method

Return the now CAML value.
public Now ( ) : string
return string

Or() public method

Creates CAML or by with the specified left and right conditions.
public Or ( string leftCondition, string rightCondition ) : string
leftCondition string The left condition.
rightCondition string The right condition.
return string

OrderBy() public method

Creates CAML order by with the specified arguments.
public OrderBy ( ) : string
return string

OrderBy() public method

Creates CAML order by with the specified field references.
public OrderBy ( string fieldRefElements ) : string
fieldRefElements string The field reference elements.
return string

ProjectProperty() public method

Creates CAML project property with the specified property name.
public ProjectProperty ( string propertyName ) : string
propertyName string Name of the property.
return string

ProjectProperty() public method

Creates CAML project property with the specified property name and default value.
public ProjectProperty ( string propertyName, string defaultValue ) : string
propertyName string Name of the property.
defaultValue string The default value.
return string

ProjectProperty() public method

Creates CAML project property with the specified condition.
public ProjectProperty ( string propertyName, string defaultValue, CamlEnums autoHyperlinkType, bool autoNewLine, bool expandXml, bool htmlEncode, bool stripWhiteSpace, CamlEnums urlEncodingType ) : string
propertyName string Name of the property.
defaultValue string The default value.
autoHyperlinkType CamlEnums Type of the automatic hyperlink.
autoNewLine bool if set to true [automatic new line].
expandXml bool if set to true [expand XML].
htmlEncode bool if set to true [HTML encode].
stripWhiteSpace bool if set to true [strip white space].
urlEncodingType CamlEnums Type of the URL encoding.
return string

SafeIdentifier() public method

Creates CAML safe identifier by with the specified identifier value.
public SafeIdentifier ( string identifier ) : string
identifier string The identifier.
return string

TermFilter() public method

Generates a CAML filter for a Taxonomy Term in a global farm term store group
public TermFilter ( SPList list, string taxonomyFieldInternalName, Guid termId, bool includeDescendants ) : string
list SPList The list over which the query will be done
taxonomyFieldInternalName string The name of the site column associated with the term set
termId Guid Guid by which to find the term (dupes not supported)
includeDescendants bool Whether the Term's child terms should be query hits as well
return string

TermFilter() public method

Generates a CAML filter for a Taxonomy Term
public TermFilter ( SPList list, string taxonomyFieldInternalName, IList terms, bool includeDescendants ) : string
list SPList The list over which the query will be done
taxonomyFieldInternalName string The name of the site column associated with the term set
terms IList List of terms for why we want to match in an OR fashion
includeDescendants bool Whether the Term's child terms should be query hits as well
return string

TermFilter() public method

Generates a CAML filter for a Taxonomy Term
public TermFilter ( SPList list, string taxonomyFieldInternalName, Term term, bool includeDescendants ) : string
list SPList The list over which the query will be done
taxonomyFieldInternalName string The name of the site column associated with the term set
term Term Term to match for
includeDescendants bool Whether the Term's child terms should be query hits as well
return string

TermFilter() public method

Generates a CAML filter for a Taxonomy Term from the site-collection-reserved term store group
public TermFilter ( SPList list, string taxonomyFieldInternalName, string termSetName, string termLabel, bool includeDescendants ) : string
list SPList The list over which the query will be done
taxonomyFieldInternalName string The name of the site column associated with the term set
termSetName string Name of the term set
termLabel string Label by which to find the term (dupes not supported)
includeDescendants bool Whether the Term's child terms should be query hits as well
return string

TermFilter() public method

Generates a CAML filter for a Taxonomy Term in a global farm term store group
public TermFilter ( SPList list, string taxonomyFieldInternalName, string termStoreGroupName, string termSetName, string termLabel, bool includeDescendants ) : string
list SPList The list over which the query will be done
taxonomyFieldInternalName string The name of the site column associated with the term set
termStoreGroupName string Name of the global farm term store group
termSetName string Name of the term set
termLabel string Label by which to find the term (dupes not supported)
includeDescendants bool Whether the Term's child terms should be query hits as well
return string

Today() public method

Gets the today value tag.
public Today ( ) : string
return string

Today() public method

Todays the specified include time value.
public Today ( bool includeTimeValue ) : string
includeTimeValue bool if set to true [include time value].
return string

Today() public method

Gets the today value tag.
public Today ( int offsetDays ) : string
offsetDays int The offset days.
return string

Today() public method

Todays the specified offset days.
public Today ( int offsetDays, bool includeTimeValue ) : string
offsetDays int The offset days.
includeTimeValue bool if set to true [include time value].
return string

Value() public method

Creates CAML value with the specified value.
public Value ( DateTime fieldValue ) : string
fieldValue DateTime The field value.
return string

Value() public method

Values the specified field value.
public Value ( DateTime fieldValue, bool includeTimeValue ) : string
fieldValue DateTime The field value.
includeTimeValue bool if set to true [include time value].
return string

Value() public method

Creates CAML value with the specified value.
public Value ( bool fieldValue ) : string
fieldValue bool The field value.
return string

Value() public method

Creates CAML value with the specified value.
public Value ( int fieldValue ) : string
fieldValue int The field value.
return string

Value() public method

Creates CAML value with the specified value.
public Value ( string fieldValue ) : string
fieldValue string The field value.
return string

Value() public method

Creates CAML value with the specified type and value.
public Value ( string valueType, string fieldValue ) : string
valueType string Type of the value.
fieldValue string The field value.
return string

ViewFields() public method

Creates CAML view fields with the specified fields.
public ViewFields ( ) : string
return string

ViewFieldsForEntityType() public method

Creates CAML view fields with the specified entity type.
public ViewFieldsForEntityType ( Type entityType ) : string
entityType Type Type of the entity.
return string

Webs() public method

Creates CAML webs with the specified scope.
public Webs ( CamlEnums scope ) : string
scope CamlEnums The scope.
return string

Where() public method

Creates CAML where with the specified condition.
public Where ( string condition ) : string
condition string The condition.
return string

WithIndex() public method

Creates CAML with index than with the specified field ID and value.
public WithIndex ( Guid fieldId, string fieldValue ) : string
fieldId Guid The field identifier.
fieldValue string The field value.
return string

Xml() public method

Creates CAML XML with the specified condition.
public Xml ( string condition ) : string
condition string The condition.
return string