Latest Posts

Posted by admin on 19th December 2008

No post in a long time…

I’ve been working on a fairly extensive SharePoint project the last few weeks and I think I’ve taken my SharePoint knowledge to another level.

There might be a post or two from what I’ve experienced and solved in this current project.

Later…

Posted by admin on 5th August 2008

SharePoint debugging

I finally found a great article about debugging in SharePoint over at elumenotion.com. He talks about how you can debug your SharePoint project (or any other project I think) with your dll file in the Global Assembly Cache (GAC).

Check it out and be sure you set your <compilation debug=”true”>.

I got an exception “Cannot evaluate expression because the code of the current method is optimized.” while I debugged for the first time so I had to right-click on my project and uncheck “Optimize code” in Visual Studio 2008.

Finally I’m able to debug my project properly.

Posted by admin on 21st July 2008

ListInstance and "Object reference not set to an instance of an object"

Description
While activating a feature that contains list instances I get an “Unknown error” message in the SharePoint UI.

Log Entry
The element ‘NameOfListInstance’ of type ‘ListInstance’ for feature ‘MyCompany.SharePoint’ (id: 00000000-0000-0000-0000-000000000000) threw an exception during activation: Object reference not set to an instance of an object.

My solution
After a lot of debugging I noticed that if I remove the RootWebOnly=”TRUE” attribute from the ListInstance element the error goes away.

Posted by admin on 16th July 2008

Storing configuration values

I found a create post about storing custom configuration values for your SharePoint solutions. Check it out at Chris O’Brien’s blog

Posted by admin on 15th July 2008

Custom Content Type and Rich Text

Ok so here is my scenario:

I’m developing a custom SharePoint solution that includes …

  • a custom content type
  • numerous fields including RichText enabled fields
  • list template
  • a custom control template for my new/edit/display forms

The problem:

Everything was rendering perfectly except my RichText fields.

The solution:

Define your field and reference it in the ContentType xml file

<Field ID="{D5C2A287-02B5-47b1-9865-AC8300A00E86}"
       Name="MyRichTextField"
       StaticName="MyRichTextField"
       DisplayName="My RichText"
       RichText="TRUE"
       RichTextMode="FullHtml"
       Type="Note"
       Hidden="FALSE"
       />

Remember to put this field definition also in the schema.xml file

In your control template simply write

<SharePoint:FormField FieldName="MyRichTextField"
                      runat="server" />

That’s it. My headache was because I had forgot to update the field definition in the schema.xml file with my rich text parameters.

And also if you would like to control the richtext fields width for example. Override the .ms-rtelong style with your preferred width like

.ms-rtelong { width: 100%; }

Best regards,
Sigurbjörn

Posted by admin on 14th July 2008

Err… Value does not fall within the expected range

I got this beautiful error message earlier when trying to activate a custom feature I’m working on. “Value does not fall within the expected range.” Did a google search and found out that there might be something wrong with one of the XML files.

After a good hour and a half I noticed that I had left a bracket “}” in the <ContentType> ID attribute, bad!

Be careful with those ID’s.

Posted by admin on 13th July 2008

Part 1 – Creating the SharePoint project

This is the first part in a series of walkthroughs specially written for developers beginning SharePoint development. I’m also a beginner and after a few weeks of reading books, blogs and watching countless screen-casts I’ve finally got to that point where I’m familiar with the fundamental elements and environment of SharePoint development.
 
Part 1 is only the beginning and should be a walk in the park for everybody. We will set up our Visual Studio project and deploy a simple-do-nothing feature to SharePoint. I encourage you to follow this walk-through shouldn’t take more than 10 minutes or so.
 
If you are not familiar with STSDEV I would recommend that you go to the introduction of these series and read up on some prerequisites.

Lets begin

  • Open up Visual Studio 2008
  • Click Tools › STSDEV
  • Insert the Solution NameSG.SharePoint” (or something you prefer)
  • Choose your Parent Directory “C:\Demo”
  • Create a new Signing Key“C:\Demo\DemoKey.snk
  • Choose Simple Feature Solution as your Solution Type
  • Choose Visual Studio 2008 .Net 3.0 as your project version type
  • Click the Create Solution button

  • Choose Site Collection from the Feature Scope dialog box

 

Customise the project

Now you have created the SharePoint project that we are going to work with in these series of walk-troughs. We are only going to customise it a little bit for now.

  • Go to File › Open › Project/Solution… and open the project you created above.
  • You are presented with a security warning but don’t worry just choose “Load project normally” and click OK

  • No we have our project open and we are just going to change a couple of parameters and then test our solution
  • Open up RootFiles\TEMPLATE\FEATURES\SG.SharePoint\feature.xml

       

  • Change the Title and Description attribute to what you prefer.

Simple Feature ready

As I mentioned in the beginning of this part that we are only going to make the simplest feature possible. Just to make sure that everything builds and deploys correctly to begin with.

  • In the Solution Configuration drop-down list select DebugDeploy and build your project CTRL+SHIFT+B. (I prefer to do a Rebuild cause sometimes my solution doesn’t build)

  • You can watch the build progress in the output window

  • When the build has completed fire up a browser and browse to the SharePoint server
  • Click on Site Actions › Site Settings
  • Choose Site Collection Features from the Site Collection Administration section
  • Now you should be able to see your new feature.

Conclusion

We have now created a basic SharePoint project that we are going to use and build upon in future parts of this series.

That’s it for this part. Stick around for the next part as we are going to take it a step further and prepare our project for some advanced features, like Workflows and integrate our custom .aspx pages with code-behind.

Posted by admin on 13th July 2008

Developing a custom SharePoint solution

My name is Sigurbjörn Guðjónsson, and I live in Reykjavík, Iceland. I recently started working as a developer for Focal Software & Consulting (www.focal.is). My job description is a .Net developer and I’m currently working in the SharePoint environment.

I was first introduced to SharePoint late last June so I’ve got just about +3 weeks of trial and error (mostly error) under my belt. I’ve read books, blogs and watch quite a few screencasts. So I guess that right now you can consider me to be a beginner in SharePoint development.

This post is an introduction into a series of walk-throughs for developers beginning ( or just interested in) SharePoint development. I’ll try to show you how you can create a custom SharePoint solution from scratch that, as far as I know, uses the most common elements of SharePoint.

We will create a simple feature solution that includes a content-type, custom field type, list template and definition along with workflows and custom .aspx pages that use code-behind like we all love (and hate). I’ll show you how I combine all these elements together into a custom application specially written for Windows SharePoint Services 3.0 (WSS).

Oh and by-the-way. This is my first time writing a blog so bare with my (I’ll hopefully get better) and keep those comments coming.

Prerequisites

I’ll be using Visual Studio 2008 running on Windows Server 2003 in a virtual machine environment and the STSDEV 1.3 (http://www.codeplex.com/stsdev) plugin to assist me in creating my project.

I strongly recommend that you setup your development environment in a virtual machine, tough it might be slower it beats having to constantly re-install SharePoint on your desktop/laptop and saves you from screw-ups you might get yourself into.

Also I recommend you to visit the STSDEV website at CodePlex on how to install this magnificent application and watch their tutorials.

What’s next

I hope that my effort will help somebody out there starting their journey into SharePoint.

So here is part 1 of my series, enjoy.