SharePoint Experts, Information Architects, Expert Witness

We provide consulting in a broad array of business and technology from architecture to design to deployment of global systems with a focus on surfacing data in the enterprise. Specialists in Microsoft, we are a premier provider of SharePoint Expertise (including 2016 and Office 365). We also provide Expert Witness/Legal Expert in eDiscovery, source discovery, patent infringement, piracy and more! We also have established SICG DLDS s.a. - our counterpart in Costa Rica that specializes in water systems (http://www.crwatersolutions.com) - Contact me direct: david_sterling@sterling-consulting.com or call 704-873-8846 x704.

Search This Blog

Tuesday, April 27, 2010

Exception form HRESULT: 0x80040e14

While I've seen it posted elsewhere, this is another place! This error usually occurs when running an STSADM command, typically attempting to do a Restore of a backup. This error indicates that SQL Server does not have enough space to provision the data. Two fixes: 1) remove some files from the Hard Drive to free up some space - 2) Verify you have enough space and run the command again. One or the other should fix you up.

Wednesday, April 14, 2010

Trying to Test SharePoint Cache for 2007???

I recently came into an issing when trying to test the SiteMapProvider cache in MOSS 2007 and using GetCachedListItemsByQuery; in specific, I was testing it a class using an Application and came across an odd error with this line of code:

PortalWebSiteMapNode portalNode = (PortalWebSiteMapNode)portalSiteMapProvider.FindSiteMapNode(web.ServerRelativeUrl);

Which returned:

Unable to cast object of type 'Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode' to type 'Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode'.

This common routine is based on the following code:

public static SiteMapNodeCollection GetCache(string listName, SPQuery query, string siteUrl)
{
try
{
SiteMapNodeCollection portalItems;
SPWeb web = new SPSite("http://site").RootWeb;
// Commented out to run in App:
//SPWeb web = SPContext.Current.Site.RootWeb;
PortalSiteMapProvider portalSiteMapProvider = PortalSiteMapProvider.WebSiteMapProvider;
PortalWebSiteMapNode portalNode = (PortalWebSiteMapNode)portalSiteMapProvider.FindSiteMapNode(web.ServerRelativeUrl);
portalItems = portalSiteMapProvider.GetCachedListItemsByQuery(portalNode, listName, query, web);
return portalItems;
}
catch (Exception ex)
{
WriteEventLog(ex, "Navigation Control - Error attempting to get Cache from the PortalSiteMap Provider", "ERROR", 1000, "");
return null;
}
}

After scratching my head for a bit, tracing the object model and knowing the code Should work, I exhausted searching and found nothing like this had been covered.

The problem is that you cannot run this code unless you are in the context of the site - that is, running as a control or web part.

While this is highly contrary to the way it should be in simple .net (after all, we have full access to the SharePoint API via an app and a type is a type right?), this object model can't do it.