Il codice che segue crea una lista degli oggetti "Hidden" definiti nel current web.
Codice :
string GlobalNavigationExcludes = (string)SPContext.Current.Web.
AllProperties["__GlobalNavigationExcludes"];
Hashtable ReturnExcludedUrls = new Hashtable();
if (!String.IsNullOrEmpty(GlobalNavigationExcludes))
{
string[] ExcludedGuids = GlobalNavigationExcludes.Split(';');
for (int i = 0; i < ExcludedGuids.Length - 1; i++ )
{
string guid = ExcludedGuids[i];
Guid ExcludedGuid = new Guid(guid);
try
{
SPWeb SubWeb = SPContext.Current.Web.Webs[ExcludedGuid];
ReturnExcludedUrls.Add(SubWeb.ServerRelativeUrl, "");
}
catch (Exception e1)
{
try
{
SPListItem Page = SPContext.Current.Web.Lists["Pages"].Items[ExcludedGuid];
string ExcludedURL = String.Concat(SPContext.Current.Web.ServerRelativeUrl, "/", Page.Url);
ReturnExcludedUrls.Add(ExcludedURL, "");
}
catch (Exception e2)
{ }
}
}
}
Nessun commento:
Posta un commento