Browse by Tags

All Tags » SharePoint Development (RSS)

Quick and Simple: Provision a Web Site Using SharePoint Object Model In C#

I tried searching for a little snippet code that would show how I can create a new SPWeb in a site collection. I didn't find it as quickly or easily as I expected so I thought I'd slap together a little entry on the subject. This code creates Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs

Simple Explanation: "Value does not fall within the expected range."

When working with event receivers and other code that references SharePoint list items via the object model, I often make mistakes that generate this error at runtime: Error loading and running event receiver Conchango.xyzzyEventReceiver in xyzzy, Version Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs

Quick & Easy: Create a Folder and Assign a Content Type (Or, Have Your KPIs and Eat Them Too)

In order to work around a KPI problem I wrote about here , I did some testing and discovered that KPI's work against folders with meta data in the same way that they work against documents or list items. I proved it out by creating a new content type Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs

Quick and Easy: Get the SPFolder of an SPListItem in an Event Receiver

I hate to admit it, but I struggled with this one all day. My event receiver needs to update a field of its parent folder. This little bit shows how to do it: private void UpdateParentFolder( SPItemEventProperties properties) { SPFolder thisItemFolder Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs

Yet Another Event Receiver Debug Trick

I'm sure I'm not the first person to come up with this. However, I haven't noticed anyone publish a trick like this since I started paying close attention to the community last July. So, I thought I'd post it this quick and easy debug Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs

Solution: SPQuery Does Not Search Folders

This past week I was implementing an "evolving" solution for a client that uses BDC and SPQuery and ran into some difficulty using SPQuery against a document library containing folders. Bottom line: assign "recursive" to the view attribute Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs

MOSS KPI bug? List Indicator Tied to Document Library With Folders

We have implemented a technical solution where users upload documents to a document library. An event receiver creates a directory and moves the file to that directory (using a technique similar to what I wrote about here ). We've successfully navigated Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs

Inconvenient SharePoint 2007 localization

SharePoint 2007 has built-in support for Resource files helping you achieve localization. Using these files you are able to set localized labels for the resources being provisioned. Furthermore you are able to use Resource files within your assemblies to support localization on run time. Yet there is something wrong with localization in SharePoint 2007... One of the requirements for the project I'm currently working on is that the solution must be built on top of Dutch version of SharePoint 2007. Just to spare myself some unpleasant surprises I have decided to use that particular locale from the very beginning of the project. I got really surprised when I got a vague exception in Dutch while activating one of the Features we deliver standard with our projects. After a little research I have found out the reason of the exception: I have tried to access the Master Page Gallery using SPWeb.Lists["Master Page Gallery"]. However, since I was working with the Dutch locale it didn't exist. There was that strange thing called "Galerie met basispagina's" instead. Looking for a solution I took a look at the SharePoint object model. SPListCollection gives you three ways to obtain a list: you can use either the ID (GUID), list index (???) and the list name. It's not really convenient as all these methods use parameters which refer to variable values. Of course you could try loading the Dutch resource file shipped with the Dutch language pack for SharePoint...

Inconvenient SharePoint Solution Generator

While working with the SharePoint Solution Generator (a utility which ships with Visual Studio 2005 extensions for Windows SharePoint Services 3.0) I have stumbled upon an interesting by-design feature which affects the way you develop Features - at least if you're using or planning to use the SharePoint Solution Generator (SPSolGen). SPSolGen allows you to create a List Definition based on an existing list. It is extremely useful since the CAML schema definition is almost unreadable if you work with complex lists. What SharePoint Solution Generator does is it allows you to select an existing list using a GUI and then creates for you a Visual Studio 2005 project which contains the exported List Definition wrapped up in a SharePoint Feature. In my previous article I have described the problems I have faced while using SharePoint Solution Generator on my development environment using Visual Studio 2008. Briefly: SharePoint Solution Generator doesn't work at all. While working on a solution for this problem I have had a look at the code of SharePoint Solution Generator to figure out the way it works. After I have finished my solution I have started it. Exporting a list created using one of the standard List Definitions (like Documents, Custom List, etc.) worked perfectly. Then I have added the exported List Definition into my existing ContentDefinition Feature which wraps up provisioning custom Columns, Content Types and List Definitions. After creating a list based on my...

Exporting List Definitions in a development environment using Visual Studio 2008

Visual Studio 2005 extensions for Windows SharePoint Services 3.0 (VSeWSS) ship with a useful tool called SharePoint Solutions Generator. One of its features I use most often is creating a List Definition based on an existing list. Since the CAML schema of a list isn't really straight-forward - especially if the list uses complex settings and multiple custom views it's almost undoable to create such schema manually. Another possibility could be using List Templates instead of List Definitions. List Templates are unfortunately impossible/difficult to customize and should be used, in my opinion, in SharePoint configuration scenarios when there is no other choice. SharePoint Solution Generator comes very useful if you want to work with List Definitions but you don't want to type all the CAML yourself. VSeWSS has however one major flaw: it doesn't work on development environments using Visual Studio 2008. First of all the extensions will not even install as the setup checks the Visual Studio 2005 dependency. Even bypassing the setup and copying the installed version of SharePoint Solution Generator to a development environment using VS 2008 doesn't work: SharePoint Solution Generator throws an exception during the start. The fact that there is no tool for exporting an existing list to a List Definition has suddenly become a serious risk in the project I'm currently working on. Installing VS 2005 next to VS 2008 might be a solution. I haven't tried it personally...

Configuring SSL in SharePoint 2007 development environment

A SharePoint 2007 development can get quite complex depending on the business case and requirements of your customer. Last year I have worked on a few SharePoint 2007 solutions. During the development I have noticed that it is extremely helpful if you know how the customer's infrastructure will look like. It will help you even more if you will configure your development environment to resemble the customer's infrastructure as much as possible. One of the things you should definitely consider is working with anonymous access and SSL support from the very beginning if applicable because they have major impact on the custom code you might need to create. Examples of the things you should be considering are Regular Expression for url parsing and privileges elevation if required to access some of the SharePoint properties. Finding out that your solution doesn't work in the real environment might be painful - especially if it's after it all has been deployed. Setting up anonymous access in SharePoint 2007 is really straight forward and can be done by turning on two checkboxes. It is a bit more difficult to set up a working SSL certificate on your development machine though. It's all get difficult if you don't have the access to a server issuing certificates and all you want is a dummy certificate for development purposes only. Let's begin with creating a new SharePoint 2007 Web Application which will use SSL: The most important here is setting up the port...

Solution to Problem: "FileNotFoundException" With My Feature Receiver.

I was working on a feature last week that would add some event receivers to a specific list instance. ( I blogged a bit about that list receiver here ). Using the command line, I could install the feature with no error (but see below for the hidden error Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs

Quick & Easy: Rename Uploaded File Using SharePoint Object Model Via an Event Receiver

I have a client requirement to change the name of files uploaded to a specific document library to conform with a particular naming convention. The API does not provide a "rename()" method. Instead, we use "MoveTo(...)" . Here is a Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs

Using PowerShell for MOSS application deployment testing

Body: Way back when the first Web browser, Mosaic, was just being born at NCSA at the University of Illinois, I was in college as well, and was running Linux. I was into Unix Shell scripting – csh, ksh, zsh, etc. Once I graduated, I switched to Windows Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs

Thank You, Ted Pattison!

Body: Once again, Ted Pattison's writings provided me some critical guidance just when I needed it. I've been developing a SharePoint Application Pages application and have run into two things that Ted has helped me with. Early on in the project Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs
More Posts Next page »