/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUrl(string Url) { LoggerService.Debug(">>GetContentByUrl({0})", LoggingCategory.Performance, Url); string retVal = string.Empty; LoggerService.Debug("GetContentByUrl: about to create query", LoggingCategory.Performance); Query pageQuery = new Query(); LoggerService.Debug("GetContentByUrl: created query", LoggingCategory.Performance); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PageURLCriteria pageUrl = new PageURLCriteria(Url); Criteria allCriteria = CriteriaFactory.And(isPage, pageUrl); if (this.PublicationId != 0) { PublicationCriteria correctSite = new PublicationCriteria(this.PublicationId); allCriteria.AddCriteria(correctSite); } pageQuery.Criteria = allCriteria; LoggerService.Debug("GetContentByUrl: added criteria to query", LoggingCategory.Performance); LoggerService.Debug("GetContentByUrl: about to execute query", LoggingCategory.Performance); string[] resultUris = pageQuery.ExecuteQuery(); LoggerService.Debug("GetContentByUrl: executed query", LoggingCategory.Performance); if (resultUris.Length > 0) { retVal = PageContentAssembler.GetContent(resultUris[0]); LoggerService.Debug("GetContentByUrl: executed PageContentAssembler", LoggingCategory.Performance); } LoggerService.Debug("<<GetContentByUrl({0})", LoggingCategory.Performance, Url); return(retVal); }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> private string GetStringContentFromBrokerByUrl(string Url) { string retVal = string.Empty; Query pageQuery = new Query(); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PageURLCriteria pageUrl = new PageURLCriteria(Url); PublicationCriteria correctSite = new PublicationCriteria(PublicationId); //Todo: add logic to determine site on url Criteria allCriteria = CriteriaFactory.And(isPage, pageUrl); allCriteria.AddCriteria(correctSite); pageQuery.Criteria = allCriteria; string[] resultUris = pageQuery.ExecuteQuery(); if (resultUris.Length > 0) { PageContentAssembler loadPage = new PageContentAssembler(); retVal = loadPage.GetContent(resultUris[0]); } return(retVal); }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUrl(string Url) { string retVal = string.Empty; Query pageQuery = new Query(); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PageURLCriteria pageUrl = new PageURLCriteria(Url); Criteria allCriteria = CriteriaFactory.And(isPage, pageUrl); if (this.PublicationId != 0) { PublicationCriteria correctSite = new PublicationCriteria(this.PublicationId); allCriteria.AddCriteria(correctSite); } pageQuery.Criteria = allCriteria; string[] resultUris = pageQuery.ExecuteQuery(); if (resultUris.Length > 0) { PageContentAssembler loadPage = new PageContentAssembler(); retVal = loadPage.GetContent(resultUris[0]); } return(retVal); }
public IItem GetPageIdByIshLogicalReference(int publicationId, string ishLogicalRefValue) { try { Criteria dateCriteria = new ItemLastPublishedDateCriteria(DefaultPublishData, Criteria.GreaterThanOrEqual); CustomMetaKeyCriteria metaKeyCriteria = new CustomMetaKeyCriteria(RefFieldName); Criteria refCriteria = new CustomMetaValueCriteria(metaKeyCriteria, ishLogicalRefValue); Criteria pubCriteria = new PublicationCriteria(publicationId); Criteria itemType = new ItemTypeCriteria((int)ItemType.Page); Criteria composite = new AndCriteria(new[] { dateCriteria, refCriteria, itemType, pubCriteria }); Query query = new Query(composite); IItem[] items = query.ExecuteEntityQuery(); if (items == null || items.Length == 0) { return(new ItemImpl()); } if (items.Length > 1) { throw new TridionDocsApiException($"Too many page Ids found in publication with logical ref value {ishLogicalRefValue}"); } return(items[0]); } catch (Exception) { throw new DxaItemNotFoundException($"Page reference by ishlogicalref.object.id = {ishLogicalRefValue} not found in publication {publicationId}."); } }
/// <summary> /// this method shall be used to return the component based on a category /// </summary> /// <param name="category"></param> /// <param name="contentRepositoryId"></param> /// <param name="nbrOfRecords"></param> /// <returns></returns> public static List <XmlDocument> GetComponentsByCategory(string category, int contentRepositoryId, int nbrOfRecords) { List <XmlDocument> results; CategoryCriteria categoryCriteria = new CategoryCriteria(category); ItemTypeCriteria typeCriteria = new ItemTypeCriteria(TRIDION_ITEMTYPE); results = BuildAndExecute(contentRepositoryId, new Criteria[] { categoryCriteria, typeCriteria }, nbrOfRecords); return(results); }
/// <summary> /// /// </summary> /// <param name="schemaId"></param> /// <param name="contentRepositoryId"></param> /// <param name="noOfRecords"></param> /// <returns></returns> public static List <XmlDocument> GetContentByType(int schemaId, int contentRepositoryId, int noOfRecords) { List <XmlDocument> results; ItemSchemaCriteria schemaCriteria = new ItemSchemaCriteria(schemaId); ItemTypeCriteria typeCriteria = new ItemTypeCriteria(TRIDION_ITEMTYPE); results = BuildAndExecute(contentRepositoryId, new Criteria[] { schemaCriteria, typeCriteria }, noOfRecords); return(results); }
/// <summary> /// Get all urls of published pages /// </summary> /// <param name="includeExtensions"></param> /// <param name="pathStarts"></param> /// <param name="publicationID"></param> /// <returns></returns> public string[] GetAllPublishedPageUrls(string[] includeExtensions, string[] pathStarts) { Query pageQuery = new Query(); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PublicationCriteria currentPublication = new PublicationCriteria(PublicationId); //Todo: add logic to determine site on url Criteria pageInPublication = CriteriaFactory.And(isPage, currentPublication); if (includeExtensions.Length > 0) { PageURLCriteria[] extensionsCriteria = new PageURLCriteria[includeExtensions.Length]; int criteriaCount = 0; foreach (string pageExtension in includeExtensions) { extensionsCriteria.SetValue(new PageURLCriteria("%" + pageExtension, Criteria.Like), criteriaCount); criteriaCount++; } Criteria allExtensions = CriteriaFactory.Or(extensionsCriteria); pageInPublication = CriteriaFactory.And(pageInPublication, allExtensions); } if (pathStarts.Length > 0) { PageURLCriteria[] pathCriteria = new PageURLCriteria[pathStarts.Length]; int criteriaCount = 0; foreach (string requiredPath in pathStarts) { pathCriteria.SetValue(new PageURLCriteria(requiredPath + "%", Criteria.Like), criteriaCount); criteriaCount++; } Criteria allPaths = CriteriaFactory.Or(pathCriteria); pageInPublication = CriteriaFactory.And(pageInPublication, allPaths); } Query findPages = new Query(pageInPublication); string[] pageUris = findPages.ExecuteQuery(); // Need to get PageMeta data to find all the urls List <string> pageUrls = new List <string>(); foreach (string uri in pageUris) { TcmUri tcmUri = new TcmUri(uri); PageMetaFactory metaFactory = GetPageMetaFactory(tcmUri.PublicationId); IPageMeta currentMeta = metaFactory.GetMeta(uri); pageUrls.Add(currentMeta.UrlPath); } return(pageUrls.ToArray()); }
/// <summary> /// Get all urls of published pages /// </summary> /// <param name="includeExtensions"></param> /// <param name="pathStarts"></param> /// <param name="publicationID"></param> /// <returns></returns> public string[] GetAllPublishedPageUrls(string[] includeExtensions, string[] pathStarts) { Query pageQuery = new Query(); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PublicationCriteria currentPublication = new PublicationCriteria(PublicationId); //Todo: add logic to determine site on url Criteria pageInPublication = CriteriaFactory.And(isPage, currentPublication); if (includeExtensions.Length > 0) { PageURLCriteria[] extensionsCriteria = new PageURLCriteria[includeExtensions.Length]; int criteriaCount = 0; foreach (string pageExtension in includeExtensions) { extensionsCriteria.SetValue(new PageURLCriteria("%" + pageExtension, Criteria.Like), criteriaCount); criteriaCount++; } Criteria allExtensions = CriteriaFactory.Or(extensionsCriteria); pageInPublication = CriteriaFactory.And(pageInPublication, allExtensions); } if (pathStarts.Length > 0) { PageURLCriteria[] pathCriteria = new PageURLCriteria[pathStarts.Length]; int criteriaCount = 0; foreach (string requiredPath in pathStarts) { pathCriteria.SetValue(new PageURLCriteria(requiredPath + "%", Criteria.Like), criteriaCount); criteriaCount++; } Criteria allPaths = CriteriaFactory.Or(pathCriteria); pageInPublication = CriteriaFactory.And(pageInPublication, allPaths); } Query findPages = new Query(pageInPublication); string[] pageUris = findPages.ExecuteQuery(); // Need to get PageMeta data to find all the urls List<string> pageUrls = new List<string>(); foreach (string uri in pageUris) { TcmUri tcmUri = new TcmUri(uri); PageMetaFactory metaFactory = GetPageMetaFactory(tcmUri.PublicationId); IPageMeta currentMeta = metaFactory.GetMeta(uri); pageUrls.Add(currentMeta.UrlPath); } return pageUrls.ToArray(); }
public bool TryFindBinary(string url, out IBinary binary) { string encodedUrl = HttpUtility.UrlPathEncode(url); binary = null; //using (var sqlBinMetaHome = new Com.Tridion.Broker.Binaries.Meta.SQLBinaryMetaHome()) //{ // Com.Tridion.Meta.BinaryMeta binaryMeta = sqlBinMetaHome.FindByURL(PublicationId, encodedUrl); // "/Images/anubis_pecunia160_tcm70-520973.jpg" // if (binaryMeta != null) // { // using (var sqlBinaryHome = new Com.Tridion.Broker.Binaries.SQLBinaryHome()) // { // Com.Tridion.Data.BinaryData binData = sqlBinaryHome.FindByPrimaryKey(PublicationId, (int)binaryMeta.GetId()); // if (binData != null) // { // binary = new Binary(this) // { // Id = String.Format("tcm:{0}-{1}", binData.GetPublicationId(), binData.GetId()), // Url = url, // LastPublishedDate = DateTime.Now, // Multimedia = null, // VariantId = binData.GetVariantId() // }; // return true; // } // } // } // return false; //} Query binaryQuery = new Query(); ItemTypeCriteria isMultiMedia = new ItemTypeCriteria(32); PublicationCriteria inPub = new PublicationCriteria(PublicationId); Criteria allCriteria = CriteriaFactory.And(isMultiMedia, inPub); string[] results = binaryQuery.ExecuteQuery(); binary = null; return(true); foreach (var item in results) { } }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUrl(string Url) { LoggerService.Debug(">>GetContentByUrl({0})", LoggingCategory.Performance, Url); string retVal = string.Empty; LoggerService.Debug("GetContentByUrl: about to create query", LoggingCategory.Performance); using (var pageQuery = new Query()) { LoggerService.Debug("GetContentByUrl: created query", LoggingCategory.Performance); using (var isPage = new ItemTypeCriteria(64)) { using (var pageUrl = new PageURLCriteria(Url)) { using (var allCriteria = CriteriaFactory.And(isPage, pageUrl)) { if (this.PublicationId != 0) { using (var correctSite = new PublicationCriteria(this.PublicationId)) { allCriteria.AddCriteria(correctSite); } } pageQuery.Criteria = allCriteria; } } } LoggerService.Debug("GetContentByUrl: added criteria to query", LoggingCategory.Performance); LoggerService.Debug("GetContentByUrl: about to execute query", LoggingCategory.Performance); string[] resultUris = pageQuery.ExecuteQuery(); pageQuery.Dispose(); LoggerService.Debug("GetContentByUrl: executed query", LoggingCategory.Performance); if (resultUris.Length > 0) { retVal = PageContentAssembler.GetContent(resultUris[0]); LoggerService.Debug("GetContentByUrl: executed PageContentAssembler", LoggingCategory.Performance); } LoggerService.Debug("<<GetContentByUrl({0})", LoggingCategory.Performance, Url); return(retVal); } }
public static IPageMeta GetPageMetaFromSEO(HttpRequestBase request, string url) { PageMetaFactory pageMetaFactory = new PageMetaFactory(SiteGlobal.PublicationId); IPageMeta pageMeta = pageMetaFactory.GetMetaByUrl(SiteGlobal.PublicationId, url); if (pageMeta == null) { // Check if it is a Vanity URL var publicationCriteria = new PublicationCriteria(SiteGlobal.PublicationId); var pageCriteria = new ItemTypeCriteria((int)TridionItemType.Page); var vanityUrlCriteria = new CustomMetaValueCriteria(new CustomMetaKeyCriteria("SEOUrl", Criteria.Equal), url); // -- Query query = new Query(); query.Criteria = CriteriaFactory.And(new Criteria[] { publicationCriteria, pageCriteria, vanityUrlCriteria }); IEnumerable <string> pages = query.ExecuteQuery(); //If no result, we try taking the ApplicationPath ['/en'] fro the url if (!pages.Any() && url.ToLower().StartsWith(request.ApplicationPath.ToLower())) { var urlWithoutAppPath = url.Substring(request.ApplicationPath.Length); var vanityUrlCriteria2 = new CustomMetaValueCriteria(new CustomMetaKeyCriteria("SEOUrl", Criteria.Equal), urlWithoutAppPath); query.Criteria = CriteriaFactory.And(new Criteria[] { publicationCriteria, pageCriteria, vanityUrlCriteria2 }); pages = query.ExecuteQuery(); //If no result, we try taking the '/' from the begining of the url. if (!pages.Any()) { urlWithoutAppPath = urlWithoutAppPath.TrimStart('/'); vanityUrlCriteria2 = new CustomMetaValueCriteria(new CustomMetaKeyCriteria("SEOUrl", Criteria.Equal), urlWithoutAppPath); query.Criteria = CriteriaFactory.And(new Criteria[] { publicationCriteria, pageCriteria, vanityUrlCriteria2 }); pages = query.ExecuteQuery(); } } if (pages.Any()) { pageMeta = pageMetaFactory.GetMeta(pages.First()); } } return(pageMeta); }
public void TryRedirect(Object s, EventArgs e) { HttpContext context = HttpContext.Current; int publicationId = int.Parse(ConfigurationManager.AppSettings["GlobalPubId"]); string redirectField = ConfigurationManager.AppSettings["RedirectUrlField"]; string url = context.Request.Url.PathAndQuery; int pos = url.IndexOf("?"); if (pos > 0) { url = url.Substring(0, pos); } PublicationCriteria publicationCriteria = new PublicationCriteria(publicationId); ItemTypeCriteria itemCriteria = new ItemTypeCriteria(64); CustomMetaValueCriteria cmvCriteria = new CustomMetaValueCriteria(new CustomMetaKeyCriteria(redirectField), url); AndCriteria andCriteria = new AndCriteria(new Criteria[] { publicationCriteria, itemCriteria, cmvCriteria }); Query query = new Query(andCriteria); string[] results = query.ExecuteQuery(); if (results.Length > 0) { PageLink pageLink = new PageLink(publicationId); Link link = pageLink.GetLink(results[0]); if (link.IsResolved) { // Redirect HttpResponse response = context.Response; response.Clear(); response.RedirectLocation = link.Url; response.StatusCode = 301; response.StatusDescription = "301 Moved Permanently"; response.Write("Page has moved to " + link.Url); response.End(); } } }
public void TryRedirect(Object s, EventArgs e) { HttpContext context = HttpContext.Current; int publicationId = int.Parse(ConfigurationManager.AppSettings["GlobalPubId"]); string redirectField = ConfigurationManager.AppSettings["RedirectUrlField"]; string url = context.Request.Url.PathAndQuery; int pos = url.IndexOf("?"); if (pos > 0) url = url.Substring(0, pos); PublicationCriteria publicationCriteria = new PublicationCriteria(publicationId); ItemTypeCriteria itemCriteria = new ItemTypeCriteria(64); CustomMetaValueCriteria cmvCriteria = new CustomMetaValueCriteria(new CustomMetaKeyCriteria(redirectField), url); AndCriteria andCriteria = new AndCriteria(new Criteria[] { publicationCriteria, itemCriteria, cmvCriteria }); Query query = new Query(andCriteria); string[] results = query.ExecuteQuery(); if (results.Length > 0) { PageLink pageLink = new PageLink(publicationId); Link link = pageLink.GetLink(results[0]); if (link.IsResolved) { // Redirect HttpResponse response = context.Response; response.Clear(); response.RedirectLocation = link.Url; response.StatusCode = 301; response.StatusDescription = "301 Moved Permanently"; response.Write("Page has moved to " + link.Url); response.End(); } } }
/// <summary> /// this method shall be used to return the component based on a categories and keywords /// </summary> /// <param name="category"></param> /// <param name="keywords"></param> /// <param name="contentRepositoryId"></param> /// <returns></returns> public static List <XmlDocument> GetComponentsByKeywords(string[] category, string[] keywords, int contentRepositoryId, int nbrOfRecords) { List <XmlDocument> results; Criteria criteria = null; KeywordCriteria keywordCriteria; ItemTypeCriteria typeCriteria = new ItemTypeCriteria(TRIDION_ITEMTYPE); for (int i = 0; i < keywords.Length; i++) { keywordCriteria = new KeywordCriteria(category[i], keywords[i]); if (i == 0) { criteria = CriteriaFactory.And(keywordCriteria, typeCriteria); } else { criteria = CriteriaFactory.And(keywordCriteria, criteria); } } results = BuildAndExecute(contentRepositoryId, new Criteria[] { criteria }, nbrOfRecords); return(results); }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUrl(string Url) { LoggerService.Debug(">>GetContentByUrl({0})", LoggingCategory.Performance, Url); string retVal = string.Empty; LoggerService.Debug("GetContentByUrl: about to create query", LoggingCategory.Performance); using (var pageQuery = new Query()) { LoggerService.Debug("GetContentByUrl: created query", LoggingCategory.Performance); using (var isPage = new ItemTypeCriteria(64)) { using (var pageUrl = new PageURLCriteria(Url)) { using (var allCriteria = CriteriaFactory.And(isPage, pageUrl)) { if (this.PublicationId != 0) { using (var correctSite = new PublicationCriteria(this.PublicationId)) { allCriteria.AddCriteria(correctSite); } } pageQuery.Criteria = allCriteria; } } } LoggerService.Debug("GetContentByUrl: added criteria to query", LoggingCategory.Performance); LoggerService.Debug("GetContentByUrl: about to execute query", LoggingCategory.Performance); string[] resultUris = pageQuery.ExecuteQuery(); pageQuery.Dispose(); LoggerService.Debug("GetContentByUrl: executed query", LoggingCategory.Performance); if (resultUris.Length > 0) { retVal = PageContentAssembler.GetContent(resultUris[0]); LoggerService.Debug("GetContentByUrl: executed PageContentAssembler", LoggingCategory.Performance); } LoggerService.Debug("<<GetContentByUrl({0})", LoggingCategory.Performance, Url); return retVal; } }
public bool TryFindBinary(string url, out IBinary binary) { string encodedUrl = HttpUtility.UrlPathEncode(url); binary = null; //using (var sqlBinMetaHome = new Com.Tridion.Broker.Binaries.Meta.SQLBinaryMetaHome()) //{ // Com.Tridion.Meta.BinaryMeta binaryMeta = sqlBinMetaHome.FindByURL(PublicationId, encodedUrl); // "/Images/anubis_pecunia160_tcm70-520973.jpg" // if (binaryMeta != null) // { // using (var sqlBinaryHome = new Com.Tridion.Broker.Binaries.SQLBinaryHome()) // { // Com.Tridion.Data.BinaryData binData = sqlBinaryHome.FindByPrimaryKey(PublicationId, (int)binaryMeta.GetId()); // if (binData != null) // { // binary = new Binary(this) // { // Id = String.Format("tcm:{0}-{1}", binData.GetPublicationId(), binData.GetId()), // Url = url, // LastPublishedDate = DateTime.Now, // Multimedia = null, // VariantId = binData.GetVariantId() // }; // return true; // } // } // } // return false; //} Query binaryQuery = new Query(); ItemTypeCriteria isMultiMedia = new ItemTypeCriteria(32); PublicationCriteria inPub = new PublicationCriteria(PublicationId); Criteria allCriteria = CriteriaFactory.And(isMultiMedia, inPub); string[] results = binaryQuery.ExecuteQuery(); binary = null; return true; foreach (var item in results) { } }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUrl(string Url) { LoggerService.Debug(">>GetContentByUrl({0})", LoggingCategory.Performance, Url); string retVal = string.Empty; LoggerService.Debug("GetContentByUrl: about to create query", LoggingCategory.Performance); Query pageQuery = new Query(); LoggerService.Debug("GetContentByUrl: created query", LoggingCategory.Performance); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PageURLCriteria pageUrl = new PageURLCriteria(Url); Criteria allCriteria = CriteriaFactory.And(isPage, pageUrl); if (this.PublicationId != 0) { PublicationCriteria correctSite = new PublicationCriteria(this.PublicationId); allCriteria.AddCriteria(correctSite); } pageQuery.Criteria = allCriteria; LoggerService.Debug("GetContentByUrl: added criteria to query", LoggingCategory.Performance); LoggerService.Debug("GetContentByUrl: about to execute query", LoggingCategory.Performance); string[] resultUris = pageQuery.ExecuteQuery(); LoggerService.Debug("GetContentByUrl: executed query", LoggingCategory.Performance); if (resultUris.Length > 0) { retVal = PageContentAssembler.GetContent(resultUris[0]); LoggerService.Debug("GetContentByUrl: executed PageContentAssembler", LoggingCategory.Performance); } LoggerService.Debug("<<GetContentByUrl({0})", LoggingCategory.Performance, Url); return retVal; }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> private string GetStringContentFromBrokerByUrl(string Url) { string retVal = string.Empty; Query pageQuery = new Query(); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PageURLCriteria pageUrl = new PageURLCriteria(Url); PublicationCriteria correctSite = new PublicationCriteria(PublicationId); //Todo: add logic to determine site on url Criteria allCriteria = CriteriaFactory.And(isPage, pageUrl); allCriteria.AddCriteria(correctSite); pageQuery.Criteria = allCriteria; string[] resultUris = pageQuery.ExecuteQuery(); if (resultUris.Length > 0) { PageContentAssembler loadPage = new PageContentAssembler(); retVal = loadPage.GetContent(resultUris[0]); } return retVal; }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUrl(string Url) { string retVal = string.Empty; Query pageQuery = new Query(); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PageURLCriteria pageUrl = new PageURLCriteria(Url); Criteria allCriteria = CriteriaFactory.And(isPage, pageUrl); if (this.PublicationId != 0) { PublicationCriteria correctSite = new PublicationCriteria(this.PublicationId); allCriteria.AddCriteria(correctSite); } pageQuery.Criteria = allCriteria; string[] resultUris = pageQuery.ExecuteQuery(); if (resultUris.Length > 0) { PageContentAssembler loadPage = new PageContentAssembler(); retVal = loadPage.GetContent(resultUris[0]); } return retVal; }