Skip to main content

Posts

PublishingAssociatedContentType

The Content Type to be associated with a page layout is indicated by the 'PublishingAssociatedContentType'. In the actual sense it means a binding setting between the Page Layout and the content type. If you fail to provide one, the SharePoint framework will make use of the Page Content type. The format of the binding is: ';# e.g. ';#ContentPage;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900470b13dd348649d08f9e5151501df9a4000dbd46dad8d045f98c83ad983b66d3f2;#'. where Content Type name: ContentPage Content Type ID: 0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900470b13dd348649d08f9e5151501df9a4000dbd46dad8d045f98c83ad983b66d3f2 respectively. QED

INSERT KEYWORDS AND DESCRIPTION INTO A PAGE PROGRAMMATICALLY

In other to build the right asp.net site, there is always a need to inject keywords and description for search engines to crawl. So to do that quickly... Of course, the simplest way to add these tags is manually to the HTML part of your ASP.NET page like this: System.Web.UI.HtmlControls.HtmlMeta mKeywords = new System.Web.UI.HtmlControls.HtmlMeta(); mKeywords.Name = "MyKeywords"; mKeywords.Content = "meta1, meta2, meta3"; Page.Header.Controls.AddAt(1, mKeywords); System.Web.UI.HtmlControls.HtmlMeta mDescription = new System.Web.UI.HtmlControls.HtmlMeta(); metaDescription.Content = "This page does a lot"; mDescription.Name = "MyPage"; Page.Header.Controls.AddAt(1, mDescription); In other to create a page in ASP.NET in the latest framework: Page.mDescription = "this is my description."; Page.mKeywords = "key1, key2, key3"; What about assets include, HtmlLink mlink = new HtmlLink(); mlink.Href = relativePath; mlink.Attr...

ACTIVATING THE TAXONOMY FEATURE

Suprisingly, the Taxonomy feature is hidden in SharePoint 2010 and is not viewable in the user interface. In other to activate the feature > Fire your SharePoint PowerShell > Type the command Enable-SPFeature -id "73EF14B1-13A9-416b-A9B5-ECECA2B0604C" -url thesiteurl I hope this will save somebody few minutes of searching... QED

HOW TO CREATE SPFieldLookup programmatically

This is a nice snippet I saw and will like to share Let us assume we have two list aList and bList already created. Requirement is to create a lookup column in aList which will look up values in bList. SPList aList = web.Lists["aList"]; SPList bList = web.Lists["bList"]; aList.Fields.AddLookup("Lookup", bList.ID, false); SPFieldLookup fldLookup = aList.Fields["Lookup"] as SPFieldLookup; fldLookup.LookupField = bList.Fields[SPBuiltInFieldId.Title].InternalName; fldLookup.Update();

ERROR DISPLAY SHAREPOINT

By default, the SharePoint web config only displays vague custom error which for a developer usually does not provide any meaning. To enable clear error display, do the following: Open the web config for editing, this is located inside the wwwroot. Make sure you select the right port number. The default post is 80. Find the "CallStack" attribute in the SafeMode section, change the value from false to true. Identify the "CustomErrors" in System.Web section, change the value from On to Off. Please note that this would be unnecessary in a production environment and it is only suitable in a test environment.