Dynamics CRM 2011 Portal Development
CrmSiteMap expression
More information regarding to ASP.NET Site Maps and SiteMapProvider Class
CrmSiteMap expression require ASP.NET sitemap feature enabled and Microsoft.Xrm.Portal.Web.CrmSiteMapProvider to be the default sitemap provider. CrmSiteMapProvider use Site Marker entity (adx_sitemarker) contained in portalbase solution as persistent store.This can be set up in web.config
<?xml version="1.0"?> <configuration> <system.web> <siteMap enabled="true" defaultProvider="Crm"> <providers> <clear/> <add name="Crm" type="Microsoft.Xrm.Portal.Web.CrmSiteMapProvider, Microsoft.Xrm.Portal" securityTrimmingEnabled="true"/> </providers> </siteMap> <system.web> <configuration>
Syntax:
<%$ CrmSiteMap: SiteMarker=siteMarker, Return=return, Eval=eval, Format=format, Portal=portal%> <%$ CrmSiteMap: siteMarker, return, eval, format, portal%>
Snippet Expression takes a format of comma separated name value pairs, any pair is optional and the name of the pair is optional as well. If name is omitted, then the sequence is significant.
The first name value pair (SiteMarker) is the value of Name attribute (adx_name) of Site Marker entity (adx_sitemarker) contained in portalbase solution.
One instance of CrmSiteMapNode will be created for the rest of expression evaluation.
CrmSiteMapNode contains four more extra properties than base ASP.NET SiteMapNode object: Entity, LastModified, RewriteUrl and StatusCode. The entity will be the Web Page (adx_webpage) entity instance related to the Site Marker entity (adx_sitemarker) with the name specified.
The Web Page (adx_webpage) entity will be retrieved from CRM first, and the Partial Url (adx_partialurl) attribute value will be used to find CrmSiteMapNode within sitemap. If special value āCurrentā is specified, the current web page path will be used to find CrmSiteMapNode within sitemap.
CrmSiteMapProvider use Site Marker entity (adx_sitemarker) contained in portalbase solution as persistent store. SiteMap is defined as a view of Site Marker entity for the specified web site. If the partial url/web page path from the previous description is found in this list of Site Marker entities. A corresponding CrmSiteMapNode will be created otherwise one CrmSiteMapNode instance with āPage Not Foundā Site Marker will be created. If āPage Not Foundā Site Marker does not exist in CRM, null will be returned.
The second name value pair (Return) can be set to either āEntityā or āUrlā, if it is not specified the value of Eval and Format will determine the expression value, if any other value is specified an instance of CrmSiteMapNode will be returned.
If it is set to āEntityā, the value of the expression will be the Web Page (adx_webpage) entity instance related to the Site Marker entity (adx_sitemarker) with the name specified for the first name value pair.
If it is set to āUrlā, the value of the expression will be the Partial Url (adx_partialurl) attribute value of the Web Page (adx_webpage) entity instance related to the Site Marker entity (adx_sitemarker) with the name specified for the first name value pair.
If we have the following web page created within CRM (Name=āView Scheduled Servicesā Partial Url=āview-scheduled-servicesā)
![]()
the following Site Marker created within CRM which related to the previous web page (Name=āView Scheduled Servicesā Page=āView Scheduled Servicesā)
![]()
The following expression
<asp:Literal ID="Literal1" runat="server" Text="<%$ CrmSiteMap: SiteMarker=View Scheduled Services, Return=Entity%>" />
will produce the following error, this verify that the value of the CrmSiteMap expression is an Entity with logical name āadx_webpageā

The following CrmSiteMap expression will be evaluated to ā/view-scheduled-servicesā
<asp:Literal ID="Literal1" runat="server" Text="<%$ CrmSiteMap: SiteMarker=View Scheduled Services, Return=Url%>" />
The third and fourth name value pair (Eval & Format) will only be taken into consideration when second name value pair (Return) is not specified. The value then will be passed as parameters to System.Web.UI.DataBinder.Eval(CrmSiteMapNode, eval, format) and the value is substituted for the expression syntax when the second name value pair is not specified.
The following expression will product āPartial Url is: /view-scheduled-servicesā
<asp:Literal ID="Literal1" runat="server" Text="<%$ CrmSiteMap: SiteMarker=View Scheduled Services, Eval=Url, Format=Partial Url is {0}%>" />

Like
Report
*This post is locked for comments