Posts

SharePoint SEO friendly navigation

I recently started working with SharePoint 2010 for Internet site.  One of the most important elements for the Internet site is being SEO (Search Engine Optimization) friendly.  We all know that SharePoint by default doesn't render the navigation in a very SEO friendly way.  It's table with table with table ... In SharePoint 2010, there is a way to change that with one simple property.  It's UseSimpleRendering for SharePoint:ASPMenu control.  All you have to is to turn this property to true and SharePoint will render the top navigation in format of <ul>  and <li> instead of tables.  The HTML markup is so much smaller in size and SEO friendly.   To make it look nice, you'll have override a set of css classes for get the look and feel that you need. You can find more information here, http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.aspmenu.usesimplerendering.aspx.

Branding MOSS 2007 Application Pages

Based on research, there are 3 ways to brand the application pages. Backup all your layouts folder file into another folder (i.e. LayoutsBackup). Change the files (i.e. application.master) in the layouts folder to satisfy your branding. [This is recommeded by Microsoft] Create a brand new layouts folder (i.e. customLayouts) and change the IIS site settings for the SharePoint web application to point to the new customLayouts folder. Use a HttpModule to change the application page master page reference. For more details, refer here . Below is a simple HTTP Module that does it using System.Web; using Microsoft.SharePoint; using System.Web.UI; namespace Aymhi.MOSS.HttpModules { public class SharePointAppPageMasterPageModule : IHttpModule { public void Dispose() { throw new NotImplementedException(); } public void Init(HttpApplication context) { context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHand...

SharePoint 2010 Certification Resources

Good starting resources for preparing SharePoint 2010 certification http://www.sharepointjoel.com/Lists/Posts/Post.aspx?List=0cd1a63d%2D183c%2D4fc2%2D8320%2Dba5369008acb&ID=323 https://partner.microsoft.com/40121315 http://www.wictorwilen.se/Post/About-the-SharePoint-2010-certifications.aspx http://techtrainingnotes.blogspot.com/2010/02/sharepoint-certification.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+TechTrainingNotes+%28Mike+Smith%27s+Tech+Training+Notes%29 https://www.microsoft.com/learning/en/us/training/sharepoint.aspx#2010sec1 http://channel9.msdn.com/learn/courses/SharePoint2010Developer/

Error adding solution to MOSS

The issue is that when you do stsadm -0 addsolution -filename "solution.wsp", you get an error message that says "Object reference not set to an instance of an object." even tho you're a SharePoint farm administrator. To solve this problem, you need to make sure Your account is in WSS_Restricted_WPG group Your account has access to SharePoint Central Admin Content database and config database. To find out your Central admin content database, Go to Central Administration site Application Management Content Databases Select the Central Administration Web Application. The content database for Central Administration will be displayed.

MOSS Workflow History Association

Based on a lot of the blog sites, SharePoint 2007 (MOSS) has a timer job that will purge the workflow history association with the work item after 60 days. For most of the users, this is not a good thing because our their audit depends on it. I have read a few solutions that can work around this issue. Use a custom list for audit and do not depend on the workflow hisory. Based on Microsoft, workflow history is not intended for audit purposes. You should probably always create a separate audit log. You can write code to log your workflow history or events to a separate list. Try to use folder structure (i.e. year, month, workflow ID, etc...) so that you don't have more than 2000 items in a view/folder. Write code to change the default days from 60 to whatever your requirement is. There is a sample code that was posted on one of the comments in this post(http://social.msdn.microsoft.com/Forums/en-US/sharepointworkflow/thread/b15b27e2-3033-418b-9731-968273d7423e). I have copied and pa...

Close/Open Web Parts Programmatically

I didn't see a lot of post that shows you how to close and open web parts programmatically. I figured I'll writer one just in case I forget how to do it later. You have to work with WebPartManager class for working with web parts. To get the web part manager, you can do the following: SPFile page = site.GetFile("pageUrl") SPLimitedWebPartManager webPartMngr = page.getLimitedWebPartManager(PersonalizationScope.Shared); Once you have the WebPartManager, you can get the web part that you want to close by doing: Foreach (WebPart webPart in webPartMngr.WebParts) { if (webPart.Title == "testWebPart") { webPartMngr.CloseWebPart(webPart); webPartMngr.SaveChanges(webPart); } } The SaveChanges() has to be done else it just won't work. After the web part is closed, you can still find it in webPartMngr.WebParts collection to re-open it. The code is basically the same as how you would close it. Just change the CloseWebPart() to OpenWebPart() instead.

Customize SharePoint Blog

What I'm trying to do is to replace the default body field with one of custom HTML field for the blog post. Because the customization that we had already done on the HTML rich editor control. In general, there are 2 things that can be done 1) site definition, and 2) feature The first thing that I tried was creating a custom blog site definition from the OOTB site defintion, since modifying OOTB files is always against the best practice and can avoid warranty in some cases. The MOSS OOTB blog site definition is located at C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\Blog. Custom Blog Site Definision Make a copy of OOTB blog site definition and rename the folder to a unique name (i.e. CustomBlog) There are a few xml files that you can modified, onet.xml (in CustomBlog/Xml) and schema.xml in each list folder. After update the site definition xml files. You'll have to do an iisreset before the changes will take effect. I have modif...