Obtain the webpart of all sub-regions in the current region.
Source: Internet
Author: User
You can use either of the following methods to obtain information about all sub-regions in this region in certain areas of the Portal:
Directly reference this class: Microsoft. Sharepoint. Portal. webcontrols. baseareawebpart . This. currentareaid gets the guid of the current region. For details, refer to the SharePoint SDK.
Another method is:
// Get the guid of the current page through the pageinfo object
Pageinfo currentpage = pageinfo. getpageinfo ();
Guid areaguid = currentpage. categoryid;
// Combine the guid of pageinfo to obtain the current region. Is it easy? Haha!
Portalcontext = portalapplication. getcontext (areaguid );
Area currentarea = areamanager. getarea (portalcontext, areaguid );
// Present the subareas of the current region
Foreach (area onearea in currentarea. Areas)
{
Output. Write ("<a href = '" + onearea. urlnavigation + "'>" + onearea. Title + "</a> <br> ");
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.