Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

PortalListItemSiteMapNode and PortalSiteMapProvider question

  Asked By: Cleveland Burch         Date: May 31, 2007      Category: Sharepoint      Views: 738
 

I have a question on PortalListItemSiteMapNode class. I am
trying to use PortalSiteMapProvider to access a large list for
optimization as they can take advantage of the caching feature of
sharepoint. My question is, I am trying to get an SPListItem object
from PortalListItemSiteMapNode object, based on my code snippet
below, I tried to get an SPListItem instance via
aPortalListItemSiteMapNode["Item"], is this correct?
Or there is another way to do it?

Below is part of my code:

SPWeb site = SPControl.GetContextWeb(Context);

//create the query
SPQuery query = new SPQuery();
query.Query = "<Where><Eq><FieldRef
Name=\"Employee_x0020_ID\"/><Value
Type=\"Text\">12345</Value></Eq></Where>";

//get the portal map provider
PortalSiteMapProvider ps =
PortalSiteMapProvider.WebSiteMapProvider;
PortalWebSiteMapNode pNode = (PortalWebSiteMapNode)
ps.FindSiteMapNode(site.ServerRelativeUrl);

//get the items from ABC library
SiteMapNodeCollection items =
ps.GetCachedListItemsByQuery(pNode, "ABC", query, site);

foreach (PortalListItemSiteMapNode pItem in items)
{
SPListItem listItem = (SPListItem)pItem["Item"];
}


 

1 Answer Found

 
Answer #1       Answered By: Micheal Knight          Answered On: May 31, 2007       

Take a look at the following method GetCachedListItemsByQuery of the
PortalSiteMapProvider

msdn2.microsoft.com/.../...ft.sharepoint.publishing" target="_blank" rel="nofollow">msdn2.microsoft.com/.../...t.sharepoint.publishing
.navigation.portalsitemapprovider.getcachedlistitemsbyquery.aspx
<msdn2.microsoft.com/.../...ft.sharepoint.publishin
g.navigation.portalsitemapprovider.getcachedlistitemsbyquery.aspx>

You can't cast a PortalListItemSiteMapNode to an SPListItem. You can
access the properties of an SPListItem using the Indexer available
through PortalListItemSiteMapNode.

This BLOG entry may also shed some light on what you are trying to
accomplish.

http://blogs.msdn.com/ecm/rss_tag_Performance.xml

 


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].