Monday, December 15, 2008

SharePoint: Adding Sub sites to the Top Navigation using SharePoint Object Model

Issue:

Add site S1 (http://localhost:30000/S1 ) to the sharepoint (http://localhost:30000), it appears in the top navigation, now add another site S2 (http://localhost:30000/S2 ) to the sharepoint, click on S1, S2 is not visible in the top navigation

Resolution:

// objSubWeb is the object of the SPWeb pointing to the sub site

objSubWeb.Navigation.UseShare = true;

Thursday, December 11, 2008

SharePoint: Resolving Web Parts Appearing as ErrorWebPart while enumerating them

Issue:
ErrorWebPart
"File not found"

Description:
After working on this issue for about One month, I found a wonderful Post by Sandeep SharePoint: All Webparts appear as ErrorWebParts when using SPLimitedWebPartManager.

Resolution:
So here is what is required to be done
1. Provide Context (see Sandeep Blog)
even if this doesn't work then
2. Make sure you custom webpart library (.dll) is either GAC'ed or you add it as reference to the application from which you are trying to read the web parts (note: if you are adding reference make sure it is the latest one).

Happy programming!

MSDN: U.S. Local Highlights