Friday, March 6, 2009

Enabling Entity Framework (ADO.NET Entity Data Model) in a SharePoint 2007 web.config file

The Entity Framework is considered to be the modern day successor to "LINQ to SQL". If you wish to use this technology in a SharePoint 2007 web part you will need to tweak your web.config file to accomodate the new assemblies that are associated with the Entity Framework. Here are the changes that you need to apply to your web.config file:

1) Add the following tags to the <compilation><assemblies> section:

<add assembly="System.Data.Entity, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089" />

<add assembly="System.Data.Entity.Design, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089" />

<add assembly="System.Web.Entity, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089" />

2) Add the following tags to the <compilation> section just under the closing </assemblies> tag:


<add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider" />


Tuesday, March 3, 2009

How can you get the thumbnail for an image in your SharePoint picture library?

This is much easier than I had imagined. At first I thought I need to do some programming with the SharePoint Object Model APIs. It turned out to be nothing of the sort.

Let us assume that you have a photograph located in your picture library named "pictures" at this URL:

The thumbnail for the above picture is located at:

As you can see, here's what I did:

1) tag a directory "_t" to the the URL just before the filename.

2) tag "_jpg" to the filename just before the extention. This would have been "_gif" if you are dealing with a GIF file.

Voila, if you point your browser to this tweaked URL you will get your thumbnail.

You will get a larger image if you use _w instead of _t.

Painless eh. . .