如何为托管解决方案添加含WebResource子区域的自定义站点地图组?
Got it, let's break down exactly how to implement this while ensuring your sitemap stays identical pre- and post-solution installation. Since you already understand Dynamics' merge mechanics, we'll focus on the concrete XML modifications and best practices for managed solutions.
Step 1: Modify the customizations.xml Snippet
You'll need to add your custom Group and SubArea as a child of the existing Marketing Area (Id="MA") in your sitemap. The key here is to make an incremental change—don't overwrite the entire SiteMap, just extend the existing Area.
Here's the updated code snippet that fits with your provided XML:
<SiteMap> <SiteMap IntroducedVersion="7.0.0.0"> <!-- Reference the existing Marketing Area (don't modify its core attributes) --> <Area Id="MA" ResourceId="Area_Marketing" DescriptionResourceId="Marketing_Description" Icon="/_imgs/marketing_24x24.png"> <!-- Add your custom Group --> <Group Id="Custom_WebResource_Group" ResourceId="Custom_Group_Label" DescriptionResourceId="Custom_Group_Desc" IsProfile="false"> <!-- Add the SubArea pointing to your WebResource --> <SubArea Id="Custom_WebResource_SubArea" ResourceId="Custom_SubArea_Label" Url="$webresource:new_mycustomwebresource.html" Icon="/_imgs/custom_24x24.png"> <Descriptions> <Description DescriptionResourceId="Custom_SubArea_Desc" /> </Descriptions> </SubArea> </Group> <!-- Keep all existing Groups/SubAreas for the Marketing Area here --> </Area> <!-- Keep all other existing Areas in the sitemap unchanged --> </SiteMap> </SiteMap>
Key Details to Note:
- Group Configuration: Use a unique
Idfor your group, and reference localized resource IDs (viaResourceId) for labels/descriptions (or use static text if localization isn't needed). SetIsProfile="false"to ensure the group shows up for all user profiles. - SubArea Configuration: The
Urluses the$webresource:prefix to target your WebResource—replacenew_mycustomwebresource.htmlwith the actual name of your deployed WebResource. Use a valid icon path (system default or custom image WebResource).
Step 2: Ensure Proper Merge Behavior
Since you're familiar with Dynamics' merge rules, a quick reminder to avoid pitfalls:
- Don't modify any core attributes of the existing
Area(likeIdorResourceId). Adding child elements (your Group) will trigger a merge, not an overwrite. - Include all dependent resources (the WebResource, localized labels, and icon) in the same managed solution to ensure they deploy alongside the sitemap change.
Step 3: Package and Validate
- Add the modified
customizations.xmland all dependent resources to your managed solution. - Deploy the solution to a test environment:
- Verify the new Group and WebResource SubArea appear under the Marketing Area, while all existing sitemap content remains intact.
- Uninstall the solution:
- Confirm the sitemap reverts to its original state (no trace of your custom Group/SubArea remains).
Critical Checks
- Ensure security roles have access to the WebResource and the sitemap elements (you can set permissions via the solution's security role settings).
- Test with different user profiles to confirm the group is visible as expected.
内容的提问来源于stack exchange,提问作者Nilay Vishwakarma

