SharePoint

What to know about the feature folder

One of the first things I used to tell guys new to SharePoint development is: Never ever name the folder of your feature “Feature1”. If you create a solution with WSPBuilder, or did some time ago with VS 2008, you have to rename the folders immediately! This is how a typical SharePoint project looks like, if you create features. I guess most of us have used the mighty WSPBuilder ( http://wspbuilder.

Use Powershell ISE for SharePoint 2010

To be able to use the ISE for SharePoint, you can configure it to load the SharePoint cmdlets automatically. Scot Hillier wrote a great article about it. Read “Setting up PowerShell ISE for SharePoint 2010”. If you only want to use the SharePoint cmdlets once, you can register them with this two lines: If ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) { Add-PSSnapIn -Name Microsoft.SharePoint.PowerShell }

SharePoint 2010 and HTML5

“v5.master” is a simple HTML5 master page designed for SharePoint 2010. It makes good use of the amazing new features of both HTML5 and CSS3, including CSS3 media queries. The master page is extremely simplistic in nature, and is truly meant to serve as a framework for building your own SharePoint 2010 customizations. Here comes some good news for SharePoint and HTML 5. If you want to build your masterpage for HTML 5, you can: http://kyleschaeffer.

SharePoint 2010 October 2011 CUs have been released

Description of the SharePoint Foundation 2010 cumulative update package (SharePoint Foundation server-package): October 13, 2011 Description of the SharePoint Server 2010 cumulative update package (SharePoint server-package): October 13, 2011

SPUrlUtility.CombinePath

Here is another “watch out” for using the SharePoint object model. SPUrlUtility.CombineUrl(web.Url, string.Empty) The line above will throw an exception, as CombinUrl doesn’t like empty strings. 🙂

Updates for SharePoint 2010 Products, changed update strategy!

The latest updates can be found on this technet website: http://technet.microsoft.com/en-us/sharepoint/ff800847 I was looking for the August 2011 updates. They are not released yet. But I found an interesting text on the page: The packaging of cumulative updates changed as of August 31, 2011. The following packages are provided for cumulative updates: SharePoint Foundation 2010 SharePoint Foundation 2010 + SharePoint Server 2010 SharePoint Foundation 2010 + SharePoint Server 2010 + Project Server 2010 As a result of the new packaging, it is no longer necessary to install the SharePoint Foundation cumulative update and then install the SharePoint Server cumulative update.

StaticName != InternalName

Recently I was trying to fetch a SPField from a SPWeb object. I had SharePoint 2010, so I decided to use the new SPFieldCollection.TryGetFieldByStaticName() Method. You can imagine how surprised I was, that I couldn’t get the field I was looking for. What do we learn? Well, the StaticName of an SPField is not necessarily the InternalName! Here is a link to the MSDN about SPField.StaticName: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfield.staticname.aspx

Watch out for ContentTypeBindings

If you don’t know ContentTypeBindings, take a short look at: http://msdn.microsoft.com/en-us/library/aa543598.aspx “Content type binding enables you to provision a content type on a list defined in the onet.xml schema.” So we can assign content types to newly created lists. That’s cool 🙂 The ContentTypeBinding feature can, of coarse, contain multiple content types which are bound to multiple lists. Like this: <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <ContentTypeBinding ContentTypeId="0x0100yourGuid" ListUrl="Pages" /> <ContentTypeBinding ContentTypeId="0x0100anotherGuid" ListUrl="Pages" /> <ContentTypeBinding ContentTypeId="

Searchscope contains no elements

With Alternate Access Mappings you add more URLs to a SharePoint webapplication. If you plan to use an alternate URL, you should use only the default URL in rules for a search scope. Otherwise the scope will not contain any items.

SharePoint 2010: Clicking the icon in Type column is highlighting the item instead of launching the document

As the title stats, with SP 2010 a click on the the icon of a listview Webpart does not open the document. This was the default behavior in the previous SharePoint version. Microsoft has realized this, and posted a knowledgebase article to get back the expected click behavior. http://support.microsoft.com/kb/2457975/en-us?sd=rss&spid=14944 The article shows you how to create a new XSLT file, which adds a link tag around the img tag of the icon.

Check, if you are within a modal dialog

By now, you probably know that the modal framework from SharePoint 2010 is a great thing 🙂 In case you need to find out if the context is within a modal dialog, you can query for the URL parameter “IsDlg”. if (Page.Request["IsDlg"] != null) { // within a modal dialog } else { // not within a modal dialog }

Empty Admin Recycle Bin items

What is it? Usually the size of the recycle bin is not relevant. But on development machines, you don’t want lots of files in there, which make your databases grow without actually used data. What do you do? Go to the recycle bin, click on “Site Collection Recycle Bin”. The two stages of the recycle bin can be managed independently. The two views on the left let you switch between the first- and second stage.

PortalSiteMapProvider.GetCachedListItemsByQuery

With MOSS 2007 or SharePoint Server 2010 you can use the PoraltSiteMapProvider of the Microsoft.SharePoint.Publishing.dll assembly to retrieve cached listitems. <span style="color:#606060" id=lnum1> 1:</span> PortalSiteMapProvider ps = PortalSiteMapProvider.WebSiteMapProvider; <span style="color:#606060" id=lnum2> 2:</span> var pNode = ps.FindSiteMapNode(web.ServerRelativeUrl) as PortalWebSiteMapNode; <span style="color:#606060" id=lnum3> 3:</span> var query = new SPQuery <span style="color:#606060" id=lnum4> 4:</span> { <span style="color:#606060" id=lnum5> 5:</span> Query = "<Where><Neq><FieldRef Name='ID' /><Value Type='Counter'>0</Value></Neq></Where>" <span style="color:#606060" id=lnum6> 6:</span> }; <span style="color:#606060" id=lnum7> 7:</span> SiteMapNodeCollection quoteItems = ps.