SharePoint 2010 Training

The public beta version is not even out yet but training is already available.

If you want to jumpstart your training or supplement it check this out:

This is just the beginning and is a very good sign that now we will have enough training available to upgrade our development skills to SharePoint 2010.

I am expecting to see much more free training materials like this in the upcoming months.

For a more formal training check the following providers they already have a story for SharePoint 2010 training:

SharePoint Live Virtual Conference

You could not make it to the SharePoint conference 2009 this year?

Want to learn more about upcoming version of SharePoint 2010?

Then check this out: November 5, 2009 from 11am-5pm ET there will be a virtual [online] **FREE** conference: SharePoint Live Virtual Conference & Expo.

Interested? Check out the session list and register today

Hope to “see” you there!

Silverlight and SP2010

I remember trying to put some demos together to demonstrate the power of Silverlight 2 Beta within the SharePoint 2007 not too long ago, and now look, the Silverlight 3 is a first class citizen in SharePoint 2010.

Out of the box you are provided with a web part that will take any xap file and render it within the page.

To interact back with the SharePoint Server one possible way is to use the new REST services available in SharePoint 2010.

For more powerful interactions, the new Client Object Model is available for .NET, JavaScript and of course Silverlight. All you need, to use the Client Object Model inside Silverlight, is to get a reference to the Microsoft.SharePoint.Client.Silverlight.dll (262KB) and Microsoft.Client.Silverlight.Runtime.dll (138KB) available under the “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions \14\TEMPLATE\LAYOUTS\ClientBin” folder.

The following code will get the site title and update it using the Client Object Model from a Silverlight application.

image image

The Silverlight can be rendered inside a web page or can be installed on the client machine.

As you can see there is no more need to dispose of the site and web objects in the Client Object Model but I will talk about this later.

For now the great news are that Silverlight applications are fully supported and the developer has multiple ways of communicating back to the SharePoint server for gathering and update data as needed.

The story gets even better: We were told during the SPC2009 (SharePoint Conference 2009) that by RTM of SharePoint 2010 the referenced dlls would not need to be stored within each of your xap files thus reducing the page payload even further when using multiple Silverlight Applications within a composite page.

Using dynamic linking will permit separate versioning of the Client Object Model and of your Silverlight Application making the upgrade story much better.

Web Parts security on SharePoint 2010

Just got out of a presentation where we got a deep dive into the new Web Part Framework for SharePoint 2010.

If you have built any web part in SharePoint  2010 and Contributors were allowed to change the custom properties once upgrading your farm to SharePoint 2010 due to a new feature, Cross-Site Scripting Safeguarding, the site contributors will not be able to see or edit the custom properties.

There are two ways to let the existing contributors on see/edit those properties:

- I would see many people that will just give them designer rights, which I don’t recommend as they will get much more power than you expect.

- The only other recommended way is to go back to development and make sure that all properties are safe from XSS (Cross-Site Scripting) by using any of the existing techniques, as encoding any string received before executing and then change the SafeAgainstScript attribute on the SafeControl tags.

On the positive side is that SharePoint 2010 makes developers more aware of the security issues with the Web Parts.

Visual Studio 2010 beta 2 available on MSDN

I am currently at the SharePoint Conference 2009. During the key notes Tom Rizzo have announced that Visual Studio 2010 Beta 2 is now available on MSDN (it should contain the new SharePoint 2010 tools).

More news:

Other news, from Steve Ballmer, were that SharePoint public beta will only be available in November and they will ship it in H1 of 2010.

It was announced too that SharePoint server installation is now supported on Windows Vista and Windows 7.

Windows 7 boot from VHD

I have start playing with the new feature (boot from VHD) available in Windows 7 and windows server 2008 R2.

Until now I always created a separate partition for the operating system, now by using the boot from VHD feature I can have a single partition and have the OS installed inside a single VHD file.

There are some things to be aware of when doing a setup like this:

  1. Be aware when using Dynamic VHDs that when the computer boots up the VHD gets expanded to the maximum size so if you created a dynamic VHD and specified 127Gb as the maximum size you better have that much space free on your hard drive or the operating system will fail with an ugly blue screen. My recommendation would be to use fixed size VHDs.
  2. There is no easy way to move from physical to boot to VHD due to the expansion of the VHD so trying to create a  VHD from a big partition with a lot of free space and then store it on that partition will fail due the VHD being expanded just a little bit more than the space available due to header information in the file.
  3. The way that I recommend doing a migration from physical to boot from VHD is to use Disk Management –> Shrink Volume before migration and then just do a Windows Backup to VHD (available starting with Windows Vista) then expand the partition back again using Disk Management thus giving you enough space for the VHD.
  4. If you try to reuse the same VHD images to run them under Hyper-V you are out of luck as the files are exclusive locked by the system and they have the physical drivers installed.
  5. I was happily surprised to see that the Swap file get stored to the main hard drive next to the VHD instead of being stored inside. This was a great improvement as it does speed up the OS, and not even mentioned during the launch event either.

In the end boot to VHD is great because it only virtualizes the HDD access giving me the possibility to have both Windows 7 and Windows 2008 R2 on the same machine. Who knows maybe in the future I will be using boot to VHD for my development machines instead of Hyper-V.

How to add Web Parts to the list item forms

As many of you know that list item forms as new, view or edit does not allow for editing the page to add web parts.

One way to overcome this issue is the use of SharePoint Designer.

However during my searches over the internet for something totally unrelated found a post talking about a hidden query string that will enable the web part management for those pages.

So here I am passing along the findings:

  1. Access the custom list and click New.
  2. Append the following to the URL: &PageView=Shared&ToolPaneView=2

That will transform your boring vanilla data entry form from something like this:

image3

To this:

image8

 

Now I wonder how many other Easter eggs are hidden inside SharePoint ?

My findings for Office 2010

I have created a new page where I will  share my finding about Office 2010 Suite while in CTP.

I am going to update that page instead of creating a new post for every thing /issue that I find so keep checking back.

http://fmuntean.wordpress.com/office-2010/

If you want me to check anything let me know using the comments on that page.

Stubbing documents in SharePoint

It is known that SharePoint keeps all its data into the SQL database. Now SQL is a relational database and there is nothing relational about storing documents into the content Database. As your SharePoint grow more and more people are storing documents into SharePoint.

When versioning is enabled on a document library each version of the document is kept separately instead of keeping only de bits that are different.

With many users on the system there is a high probability that the same document is store in multiple places in SharePoint.

 

To alleviate the problems described before we can store the documents outside SharePoint and keep only the attributes around them into the content database. This will keep the content database smaller and more manageable.

 

There are two options to achieve this:

  1. Using the External BLOB Storage API the BLOBS (this is how the documents are stored inside SQL database) can be stored outside of SharePoint content database. However this is a farm wide configuration and requires manual management of the orphaned blob files as there is no method in the interface to accommodate for this. For more info on this follow: http://technet.microsoft.com/en-us/magazine/2009.06.insidesharepoint.aspx
  2. Using a stubbing mechanism that I will describe further.

Stubbing

Defined as: a short part of something that is left after the main part has been removed; is the process of replacing the real files with a smaller file containing only the information necessary to retrieve the original file. Now the real file can be store anywhere and in any format as long it can be restored in a timely manner and unmodified.

 

How can we implement this in SharePoint?

The way that I envision is that you will create a new Stubbing Document Library that will allow for configuration of stubbing mechanism but for the end users will be transparent where the file is located physically.

If implemented correctly not only that the files are stored on an external location but duplicates could be detected and better versioning capabilities would be available thus optimizing the storage even further.

 

Few pieces are needed to make this work:

  • Event receiver for Add, Update, Delete events that will replace the real file with the stub.
  • A service that will handle the stubbing, versioning, binary diff, and any other management and reporting on the external storage.
  • An HTTP module that will catch the stub just before reaching the client and will call the service to get and return the real file to the client. (there is no Get in the event receivers)
  • Admin and configuration pages under document library settings.
  • If versioning is implemented then would be nice to have ECB items for getting more info about a certain file.

 

The Event Receiver:

We are going to need at least the following three events to handle the stubbing of a new item, updates to an existing item and deletion of an item from SharePoint.

Item Added: We will let SharePoint to finish uploading the file into the document library and then we are going to call the service  for a new stub as we have a new file. We now can replace the file with the stub keeping the filename and extension he same. the stub can be as simple as an XML.

Item Deleted: We will get the stub and call the web service to delete the file from external storage.

Item Updating: We will call the service for a new stub that is a child of the previous stub thus enabling versioning regardless of the document library having the versioning enabled. Actually enabling the versioning for this document library will complicate the things a little as we will need to handle more events.

 

The Stubbing Service:

A Web Service implementing the following methods:

Create Stub:

Parameters: file stream

Create a hash for the file and checks if the file is already in the external store.(this will handle duplicates). If the file exists then a reference count will need to be incremented and the existing stub will be cloned and returned. If the file does not exists then the file gets stored into the external storage and  a new stub get created and returned.

Update Stub:

Parameters: new file stream, old stub

Will get the file referenced into the old stub. We will create a binary diff file and store this into the external storage. Create and return a new stub and store the old stub inside it thus making a new version of the existing file.

Delete Stub:

Parameters: stub

We decrement the reference count for the specified stub and if the reference count is zero we can delete the file from the external storage.

Get:

Parameters: stub

We will get and return the file from external storage. If the file is a binary diff then we will recursively look for the parent and generate the real file before returning.

 

Most likely there is a need for a database to store hash codes, stubs counts and other metadata used by the stubbing service.

 

HTTP Module:

This is required to be able to replace the stub file with the real file when the user requests the file from SharePoint.

We are going to attach ourselves to EndRequest event using the Init method.

This will allow us to check for the content type and the request URL to determine if the user will receive a stub so we can call the web service to get it replaced by the real file.

 

Library Settings Pages:

This is where we can plug a page to configure the Stubbing web Service URL and the external storage location.

 

ECB Items:

Would be nice to have few items here that will give the user some control and information about the stub.

Un-Stub: Will replace the stub with the real file and mark that item to not be stub again.

Re-Stub: Will replace the file with the stub and clear the un-stub flag.

Versions: Will display a page with all existing versions for the current item and give the possibility to restore the item to a previous version. will be nice to give the possibility of deleting old versions too.

Error message in WSS 3.0: "The security validation for this page is invalid"

So when you deploy your page and try to run some code on the Post Back of the page you get the following error: “The Security validation for this page is invalid”. Microsoft has an Knowledge Base article but does not cover all the situations.

I have checked on the internet for the best solution to this problem and found many posts that recommends  to manually set the following:

 

site.AllowUnsafeUpdates = true;

web.AllowUnsafeUpdates = true; 

However I did not liked this solution so I looked a little bit harder and thanks to the Hristo Pavlov’s detailed investigation on the issue the best practice is:

If your code is processing a POST request then make sure you call SPUtility.ValidateFormDigest() before you do anything else. This will ensure that the post request is validated (that it is not a cross-site scripting attack) and after that you will not have to worry about AllowUnsafeUpdates, because its default value will be “true” after the form digest is validated.

To find out more about this read the two posts below:

Next Page »