Using the Core Service, how do I get a page or tcm id for a page when all I have is the live site url where the page is hosted?
http://www.mysite.com/FolderA/FolderB/pageC.html
If I .Get(uri)
a page by it's Tcm Id, the page object has LocationInfo.PublishLocationUrl = "/FolderA/FolderB/pageC.html"
, so I know the data supports a lookup. But there doesn't seem to be a way to filter for the LocationInfo.PublishLocationUrl
.
Here's how I'm getting pages, but there doesn't appear to be a way to filter for LocationInfo.
var filter = new OrganizationalItemItemsFilterData();
filter.ItemTypes = new[] { ItemType.Page };
var pages = this.Client.GetList(rootStructureGroupId, filter);
filter.BaseColumns = ListBaseColumns.Extended;
doesn't seem include any LocationInfo either.
I ended up coming up with a way to break the live site url into segments "FolderA", "FolderB", "pageC.html" and recursively grabbing all structure groups under structure groups until grabbing all pages in the final structure group and then selecting the page with the matching PublicationLocationUrl.
The problem with this approach is it's very expensive and takes too long. Grabbing child structure groups or pages via .GetList(uri)
only get partially hydrated and do not include LocationInfo
. I have to do a Get(uri)
against every object to get the fully hydrated object. It's taking a few seconds to do a look up for one url. When processes a document that contains 20 some odd urls, it takes minutes to run this logic. I figure there's got to be a better way.