SharePoint

SharePoint
Using the HOSTS file for SharePoint Development

When doing development on a SharePoint dev server, there may be the need to create multiple web applications. To prevent conflicts there are two possibilities: either use host headers or use a different port. To support host headers we can either add additional DNS entries or use the HOSTS file (C:\Windows\System32\drivers\etc). Since my dev servers generally run as isolated VM’s, creating DNS entries isn’t an option. As a result I’ll commonly make modifications to the HOSTS file such as:   # Copyright (c) 1993-2006 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for...

posted @ Friday, June 04, 2010 2:21 PM | Feedback (0)

Disentangling Render Patterns

I few months ago I posted on RenderPatterns and how they are used when creating custom fields for SharePoint. In that post the point I was trying to make was that when viewing data in a list nothing else matters except the render pattern. None of your highfalutin C# SPField derived classes can save you from the madness that is the render pattern. Never mind what MSDN says about using an .ascx control - there is no other way. So with that said, given that we’re stuck with the render pattern, it would be good to know a bit...

posted @ Tuesday, February 02, 2010 9:35 AM | Feedback (0)

Automatically generating thumbnail images in SharePoint

When you upload images to a SharePoint picture library three images are actually stored. Firstly there's the actual image that you uploaded then there are two others with specific sizes. There’s a thumbnail image that’s scaled to a particular width and is used in the default ‘All Pictures’ view then there’s a web image that’s resized to a specific width and height. The thumbnails are saved to a hidden folder in the picture library named _t and the web images are saves to a hidden folder named _w. Let’s say you have a few web parts that make use...

posted @ Thursday, January 28, 2010 2:32 PM | Feedback (0)

Extending the DataForm Web Part to allow custom field controls

Ever tried to add a custom field control to a Custom List Form in SharePoint Designer? You’d think it’d be simple, just drag the field from the toolbox and stick it on the form. Nah! We haven’t heard much from Ernő Rubik in recent years. I’m convinced he’s at Microsoft working on the SharePoint team (and doing a bit of work in the WF team when he’s got a chance) You’ll come across a few problems when trying to add your custom field control (or any other type of custom control) to a custom list form. As you may...

posted @ Tuesday, January 26, 2010 6:56 PM | Feedback (6)

In Depth: SharePoint Security Configuration – Part 1

The source code for this article is available on CodePlex Introduction If you’ve been developing applications for SharePoint for any length of time you’ll undoubtedly have come into contact with the security model. Based on the asp.net provider model, SharePoint itself does not authenticate users, it merely provides authorisation. That is to say that SharePoint does not verify that users are who they claim to be, it simply makes use of the users identity to determine what resources should be available to the user. Of course this does not mean that user identities are not verified, just that...

posted @ Wednesday, December 16, 2009 7:48 PM | Feedback (0)

Programmatically Set Item Level Security in a Document Library

December’s looking a bit bare on my blog calendar. I thought I’d better add something before the festivities begin. In truth I’ve been pretty busy over the past few weeks. I spent a few days doing an excellent CTT+ course at Rezound in Sheffield plus I’ve also just started work on a new SharePoint 2010 book for McGraw-Hill. That’s not to mention my outstanding commitment to Wrox to deliver a short e-book on SharePoint 2007 Packaging and Deployment, my ongoing development work and the joys of having two children, one of which hasn’t quite grasped the concept of sleeping yet!...

posted @ Saturday, December 12, 2009 12:53 PM | Feedback (7)

Creating Lookup fields in CAML

A few weeks ago I promised to post a few articles about extending CAML to deal with some of the elements that you’d normally have to write code in order to package. To be honest I’ve been putting it off in the hope that SharePoint 2010 and VisualStudio 2010 would make all these problems go away but it seems that that isn’t going to happen, at least not completely. So no more excuses, I may as well get on with it! I wanted to cover Lookup fields in this post. Somebody recently asked about this on the forums and...

posted @ Wednesday, November 11, 2009 11:24 PM | Feedback (1)

Silverlight Field control using HTMLBridge

Have you ever thought “it would be really cool if I could create a field control for my publishing page that would interact with all the other field controls"? I’ll bet you have, I know you don’t want to admit it because the idea is madness but I’ll bet you have! (No? I guess I’m out on my own with that one then?) I’ve only really gotten into the latest version of Silverlight in the past few weeks and I have to say I’m impressed. The potential for integration with SharePoint is huge and that’s before we consider the...

posted @ Monday, November 02, 2009 1:14 PM | Feedback (1)

Customising Navigation Data Sources

I’ve been following a few forum posts about modifying the built-in navigation providers in SharePoint and thought I’d knock up a quick post explaining, step-by-step how this can be done. Unfortunately, the documentation at MSDN is a bit cryptic (Although you’ll see by the end of this article that it makes perfect sense!) As usual, I won’t get into details about creating and deploying features. WSPBuilder is your man. (Although I’m finding SPVisualDev to be a handy wee tool as well these days) So what’s the plan then? On the default master page, you’ll see code...

posted @ Wednesday, October 21, 2009 9:21 PM | Feedback (2)

SharePoint 2010 Technical Preview Reference – Navigation Cancelled

I thought I’d have a read through the technical preview docs for SP2010 and came up against this problem: I’ve seen this problem a few times before when tying to access .CHM files. It often happens when you download SDK documentation from the web. (Unsurprisingly since it’s a security feature designed to prevent downloaded content from causing mayhem on your PC!) To fix it: Find the file that you’re trying to view, in my case: SPPT2010TP.CHM Right click then select Properties: Hit the Unblock button...

posted @ Sunday, October 18, 2009 2:53 PM | Feedback (0)

HowTo: Read Workflow Status Text

Ever wanted to be read the Status text displayed on WrkStat.aspx programmatically so that you can make use of it elsewhere? No? Can’t blame you! However, let’s say that you do fancy a bit of masochism. Here’s how it works: The status value is stored in a field of type SPFieldWorkflowStatus. Generally this field has the same display name as your workflow although it’s internal name will be different. Getting the internal name is a pain, for some bizarre reason Microsoft decided to expose this as an internal property rather than public. (See SPWorkflowAssociation.InternalNameStatusField). After...

posted @ Saturday, October 03, 2009 1:46 PM | Feedback (0)

The CAML that could

When developing an application based on SharePoint, a lot of the work goes into packaging and deployment. If you’re working as part of a team this becomes an even bigger problem since you need to be sure that your code can be deployed to each developers machine without causing mayhem and requiring a disproportionate amount of effort (quite literally two steps forward and three steps back!) As it stands at the moment, CAML is a grand idea but it doesn’t go far enough when it comes to packaging complex solutions. It’s my aim to fill in the blanks, making...

posted @ Thursday, October 01, 2009 4:59 PM | Feedback (0)

DataBinding to SPListItemCollection

This is one of those things that I always forget about and end up having to debug. (Also for those planning to do MCTS, I guarantee that there will be a question about this one ;) ) While it is technically possible to databind to a SPListItemCollection, when you try to refer to any of the SPListItem fields by name you’ll end up with an error similar to this: [ArgumentException: Value does not fall within the expected range.] Microsoft.SharePoint.SPFieldMap.GetColumnNumber(String strFieldName) +161 Microsoft.SharePoint.SPListItemCollection.GetRawValue(String fieldname, Int32 iIndex) +56...

posted @ Monday, September 07, 2009 2:40 PM | Feedback (0)

Formatting values in a Publishing Page

SharePoint Web Content Management is a pretty flexible beast, if you’re mad keen on writing code (and the ‘ole packaging and deployment curmudgeon), you can make it do pretty much anything. However, some times there are simple things that you’d like to do without having to crank up Visual Studio and start hammering out some angle brackets. One of these simple things is formatting values on a publishing page, particularly dates and Boolean values. If you’re reading this, you’ve probably made the same journey as me: Denial – There must be an easy way to do this, it’s so simple...

posted @ Sunday, September 06, 2009 2:47 PM | Feedback (0)

Invalid field name. {9da97a8a-1da5-4a77-98d3-4bc10456e700}

Problem Description When trying to create a new publishing page based on a custom content type you may encounter this error. You’re more likely to see it if you’re trying to save your page to a location other than the default /pages/ document library. Solution This problem occurs when your custom content type definition or your list definition doesn’t reference the base fields required by the publishing infrastructure. In the feature defining your content type and list make sure that you include: <!-- Title Column --> <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" Required="TRUE" /> ...

posted @ Wednesday, August 19, 2009 5:15 PM | Feedback (0)

Connection String error when installing MOSS SP2

Problem About 6 weeks ago I set about upgrading a few neglected dev servers to MOSS SP2, the process completed but reported errors similar to the following: Event Type:    Error Event Source:    SharePoint Products and Technologies Configuration Wizard Event Category:    None Event ID:    104 Date:        8/10/2009 Time:        1:49:23 PM User:        N/A Computer:    MYSERVERNAME Description: ...

posted @ Monday, August 10, 2009 8:03 PM | Feedback (5)

NavBars – If only it was that simple!

Packaging and deployment is often a pain when it comes to SharePoint development. Don’t get me wrong, the infrastructure provided by Microsoft is very powerful and flexible enough to accommodate practically anything but sometimes it doesn’t quite work the way you think it should. One of the key elements of any web site is navigation. More often than not there’s at least one menu bar containing links to other pages within the site. This is one of the areas where SharePoint can be very helpful. Whenever you create a page or any other content, more often than not you’re...

posted @ Wednesday, August 05, 2009 8:50 PM | Feedback (3)

Custom FieldTypes – Part 3

Download the source code for this project here Over the last 2 posts in this series we’ve looked at creating a new field type to handle Xml data. We’ve created a basic implementation and added a custom user interface to make editing the data a bit more friendly. In this article we’ll look at using XSD and XSLT data to provide a higher level of data validation and to give a greater degree of control over how our data is displayed within SharePoint. Previously most of the code that we’ve added has been to the BaseXmlField and SPFieldXmlBase...

posted @ Tuesday, July 28, 2009 5:34 PM | Feedback (3)

Custom FieldTypes – Part 2

Download the source code for this project here In this article we described an Xml field type that could be used for storing Xml and Xml-derived data in a SharePoint list. We got as far as creating a skeleton object that provides the basic functionality of a custom field. In this post we’ll add a custom user interface to make editing Xml data a bit more friendly. In order to generate a responsive UI I’ve made use of two client side technologies: JQuery - specifically the Dialog functionality of JQuery UI CodeMirror – specifically the...

posted @ Sunday, July 26, 2009 8:53 PM | Feedback (0)