uQuery
uComponents.Core.uQuery is a static class of helper methods:
To use the following methods add:
| returns |
method |
notes |
| List<Node> |
GetNodesByXPath(string) |
get node collection from an XPath expression (uses Umbraco Xml) can use use $ancestorOrSelf to use the currentNode if published else it'll use the nearest published parent ($currentPage will be depreciated) - the XPath expression is compiled and cached
|
| List<Node> |
GetNodesByCsv(string) |
get node collection from a CSV string of node Ids |
| List<Node> |
GetNodesByXml(string) |
currently works with XML saved by Multi-Node Tree Picker (use GetMediaByXml for Media nodes) |
| List<Node> |
GetNodesByName(string) |
returns a collection of nodes where names match |
| List<Node> |
GetNodesByType(string) |
returns a collection of nodes of docType alias |
| List<Node> |
GetNodesByType(int) |
[v2.2] returns a collection of nodes of docType id |
| Node |
GetNodeByUrl(string) |
returns a node for the supplied Url |
| Node |
GetRootNode() |
returns node -1 |
| Node |
GetCurrentNode() |
checks to see if Node.GetCurrent() returns a valid node, else attempts to get the current node via a QueryString id parameter
|
| Node |
GetNode(string) |
wrapper for null checks, string supplied is the node Id |
| Node |
GetNode(int) |
|
|
|
|
| List<Document> |
GetDocumentsByCsv(string) |
|
| List<Document> |
GetDocumentsByXml(string) |
[v2.2] |
| Document |
GetCurrentDocument() |
checks to see if the current Node can be obtained via the nodeFactory, else attempts to get via a QueryString id parameter |
| Document |
GetDocument(string) |
|
| Document |
GetDocument(int) |
|
| |
|
|
| List<Media> |
GetMediaByXPath(string) |
(uses GetPublishedXml) |
| List<Media> |
GetMediaByCsv(string) |
|
| List<Media> |
GetMediaByXml(string) |
[v2.2] currently works with XML saved by Multi-Node Tree Picker (use GetNodesByXml for Content nodes) |
| List<Media> |
GetMediaByName(string) |
|
| List<Media> |
GetMediaByType(string) |
|
| Media |
GetMedia(string) |
|
| Media |
GetMedia(int) |
|
| |
|
|
| List<Member> |
GetMembersByXPath(string) |
(uses GetPublishedXml) |
| List<Member> |
GetMembersByCsv(string) |
|
| List<Member> |
GetMembersByXml(string) |
[v2.2] |
| List<Member> |
GetMembersByType(string) |
|
| List<Member> |
GetMembersByGroup(string) |
TO BE CODED |
| Member |
GetMember(string) |
|
| Member |
GetMember(int)
|
|
| |
|
|
| XmlDocument |
GetPublishedXml(UmbracoObjectType) |
get XML from the cmsContentXml table |
| UmbracoObjectType |
GetUmbracoObjectType(string) |
get UmbracoObejctType by it's enum name |
| UmbracoObjectType |
GetUmbracoObjectType(Guid) |
get UmbracoObjectType by it's GUID value
|
| UmbracoObjectType |
GetUmbracoObjectType(int) |
get UmbracoObjectType for an item in the umbracoNode table |
| |
|
|
| bool |
IsLegacyXmlSchema() |
|
| |
|
|
| Dictionary<int, string> |
ToNameIds(List<Node>) |
extension method on List<Node> to return a Name, ID collection |
| Dictionary<int, string> |
ToNameIds(List<Document>) |
|
| Dictionary<int, string> |
ToNameIds(List<Media>) |
|
| Dictionary<int, string> |
ToNameIds(List<Member>) |
|
| |
|
|
| IEnumerable<DataTypeDefinition> |
GetAllDataTypesSorted(string propertyName) |
[v2.2] Gets all installed datatypes sorted by the specified property name. |
| Guid |
GetDataTypeGuid(int dataTypeNodeId) |
[v2.2] Gets the Guid of a datatype based on it's id. |
| |
|
|
| string |
GetDictionaryItem(string key, string fallback) |
[v2.2] Gets a dictionary item with the specified key, uses the fallback if it doesn''t exist. |
| |
|
|
| PreValue |
MakeNewPreValue(int dataTypeDefinitionId, string value, string? alias, int? sortOrder) |
[v2.2] Creates a new PreValue with the specified datatype definition id, value, alias and sort order. Alias and sort order is optional. Returns the created PreValue on success, null on failure. |
uQueryExtensions
uComponents.Core.uQueryExtensions is a namespace containing static classes with extension methods for the Umbraco Node, Document, Media, Member and RelationType objects.
To use the following methods add:
using uComponents.Core.uQueryExtensions;
umbraco.presentation.nodeFactory.Node
| returns |
method |
notes |
| IEnumerable<Node> |
GetAncestorNodes() |
these axis type methods are useful with LINQ
|
| IEnumerable<Node> |
GetAncestorOrSelfNodes() |
|
| IEnumerable<Node> |
GetPrecedingSiblingNodes() |
|
| IEnumerable<Node> |
GetFollowingSiblingNodes() |
|
| IEnumerable<Node> |
GetSiblingNodes() |
|
| IEnumerable<Node> |
GetDescendantNodes() |
|
| IEnumerable<Node> |
GetDescendantNodes(Func<Node, bool>) |
|
| IEnumerable<Node> |
GetDescendantOrSelfNodes() |
|
| IEnumerable<Node> |
GetChildNodes() |
|
| |
|
|
| Node |
GetChildNodeByName(string) |
|
| |
|
|
| bool |
HasProperty(string) |
[v3.0] |
| T |
GetProperty<T>(string) |
|
| string |
GetPropertyAsString(string) |
|
| bool |
GetPropertyAsBoolean(string) |
|
| DateTime |
GetPropertyAsDateTime(string) |
|
| int |
GetPropertyAsInt(string) |
|
| XmlNode |
GetPropertyAsXmlNode(string) |
TO BE CODED
|
| |
|
|
| int |
Level
|
[v2.1.1] calculate depth of node based on path csv |
| string |
GetImageCropperUrl(string, string) |
get the url of an image crop (propertyAlias, cropName) |
| Node |
SetProperty(string, object) |
chainable property setter - calls Document.SetProperty
|
| Node |
Publish(bool) |
calls Document.Publish [true = admin, false = current user]
|
umbraco.cms.businesslogic.web.Document
| returns |
method |
notes |
| IEnumerable<Document> |
GetAncestorDocuments() |
|
| IEnumerable<Document> |
GetAncestorOrSelfDocuments() |
|
| IEnumerable<Document> |
GetPrecedingSiblingDocuments() |
[v3.0] |
| IEnumerable<Document> |
GetFollowingSiblingDocuments() |
[v3.0] |
| IEnumerable<Document> |
GetSiblingDocuments() |
[v3.0] |
| IEnumerable<Document> |
GetDescendantOrSelfDocuments() |
[v3.0] |
| IEnumerable<Document> |
GetDescendantDocuments() |
[v3.0] |
| IEnumerable<Document> |
GetDescendantDocuments(Func<Document, bool>) |
[v3.0] |
| IEnumerable<Document> |
GetDescendantDocumentsByType(string) |
[v3.0] |
| IEnumerable<Document> |
GetChildDocuments()
|
[v3.0] |
| IEnumerable<Document> |
GetChildDocuments(Func<Document, bool>)
|
[v3.0] |
| IEnumerable<Document> |
GetChildDocumentsByType(string) |
[v3.0] |
| |
|
|
| bool |
HasProperty(string) |
[v3.0] |
| T |
GetProperty<T>(string) |
[v3.0]
|
| string |
GetPropertyAsString(string) |
|
| bool |
GetPropertyAsBoolean(string) |
|
| DateTime |
GetPropertyAsDateTime(string) |
|
| int |
GetPropertyAsInt(string) |
|
| XmlNode |
GetPropertyAsXmlNode(string) |
TO BE CODED |
| |
|
|
| Document |
SetProperty(string, object) |
- aware of built in datatypes using PreValues, so can be set by prevalue name or prevalue id
|
| Document |
Publish(bool) |
|
umbraco.cms.businesslogic.media.Media
| returns |
method |
notes |
| IEnumerable<Media> |
GetAncestorMedia() |
|
| IEnumerable<Media> |
GetAncestorOrSelfMedia() |
|
| IEnumerable<Media> |
GetSiblingMedia() |
|
| IEnumerable<Media> |
GetDescendantMedia() |
|
| IEnumerable<Media> |
GetDescendantOrSelfMedia() |
|
| IEnumerable<Media> |
GetChildMedia() |
|
| |
|
|
| bool |
HasProperty(string) |
[v3.0] |
| T |
GetProperty<T>(string) |
|
| string |
GetPropertyAsString(string) |
|
| bool |
GetPropertyAsBoolean(string) |
|
| DateTime |
GetPropertyAsDateTime(string) |
|
| int |
GetPropertyAsInt(string) |
|
| XmlNode |
GetPropertyAsXmlNode(string) |
TO BE CODED |
| |
|
|
| int |
Level |
|
| string |
GetImageCropperUrl(string, string) |
get the url of an image crop (propertyAlias, cropName)
|
| Media |
SetProperty(string, object) |
|
umbraco.cms.businesslogic.member.Member
| returns |
method |
notes |
| bool |
HasProperty(string) |
[v3.0] |
| T |
GetProperty<T>(string) |
|
| string |
GetPropertyAsString(string) |
|
| bool |
GetPropertyAsBoolean(string) |
|
| DateTime |
GetPropertyAsDateTime(string) |
|
| int |
GetPropertyAsInt(string) |
|
| XmlNode |
GetPropertyAsXmlNode(string) |
TO BE CODED |
| |
|
|
| Member |
SetProperty(string, object) |
|
umbraco.cms.businesslogic.relation.RelationType
| returns |
method |
notes |
| UmbracoObjectType |
GetParentUmbracoObjectType() |
|
| UmbracoObjectType |
GetChildUmbracoObjectType() |
|
| |
|
|
void
|
CreateRelation(int, int) |
validates ids against the objectypes defined on the RelationType
|
| bool |
HasRelations(int) |
[v2.2] |
| bool |
IsRelated(int, int) |
|
| Relation |
GetRelation(int, int) |
|
| Relation[] |
GetRelations(int) |
|
void
|
DeleteRelation(int, int) |
|
void
|
ClearRelations(int) |
|
umbraco.cms.businesslogic.datatype.PreValue
| returns |
method |
notes |
| string |
GetAlias() |
[v2.2] Gets the alias of the PreValue |
GetPrecedingSiblingDocuments()