FindCRefByURL method: PortalRegistry class
Syntax
FindCRefByURL(URL)
Description
The FindCRefByURL method returns the content reference object corresponding to URL. The URL specified by URL must be an absolute URL.
Note:
The portal registry API needs the current URI of the local node to work. During runtime, it gets this information from the current Web server. For Application Engine programs, there isn't a current Web server, so it has to get this information from the database.
If you have multiple content providers with the same URI, FindCRefByURL looks for the specified content reference with all those content providers.
To access pagelet categories and their associated pagelets, use the PageletCategories collection from the PortalRegistry object, not FindCRefByURL.
Parameters
| Parameter | Description |
|---|---|
|
URL |
A URL that represents the content. This parameter takes a string value. This URL must be an absolute URL. This parameter is case-insensitive. |
Returns
What this method returns depends on the condition of the content reference:
-
If the end-user has access to the URL, a content reference object is returned.
-
If the content reference is registered, but the end-user doesn't have access to it, a content reference is returned, but the only property you can access is the Authorized property.
-
If a URL isn't registered or is invalid, this method returns NULL.
Example
The following example finds a content reference from a URL:
&UserCRef = &Portal.FindCRefByURL("http://www.example.com");
Considerations on Returned Content References
This method returns content reference objects that aren't yet valid as well as ones that are no longer valid. When you create your program, check for these properties (ValidTo and ValidFrom) if you don't want to use them.
This method returns content reference objects that the end-user isn't authorized to. When you create your program, always check the Authorized property. This is the only property you can view from an object that the end-user isn't authorized to view.