Blog posts - sharepoint2010

Released! Content Generator 2010… my first SharePoint application

I’m really proud to announce my first SharePoint application… to be exact it’s the first tool developed and distributed by my company ‘Andreas Glaser Software Engineering GmbH’.

Management summary

Content Generator 2010 allows the automatic creation of SharePoint content and structure containing list items, documents, lists, pages, sites and sub site collections.

template1 template2 template3 template5

Features

All the features offered by my application:

  • Content generator
    Create list items, documents, lists*, pages, sites and sub site collections with predefined content. Create content on different SharePoint farms, e.g. development-, integration- and staging environment**.
  • Save time and money
    Create content once. Recreate it any time at different SharePoint farms. Don't waste the precious time of your software engineers and project managers. Find errors during development and quality assurance because you are developing with real world content.
  • Real world development
    Don't develop in a sandbox. Arrange content in a structure which is similar to your customers’ information architecture.
  • Easy to use
    Quickly create content and structure. Easy to use editor. Re-use html from any web site as your sample content.
  • Jobs creating content
    Save content and structure as templates for different customers. Create them using jobs.
  • Large quantities of content
    Create large quantities of content (list items, documents, lists, pages and sites) either by item or globally for all items.
  • Check in and approval
    Check in and approve list items, documents and pages either by item or globally for all elements.
  • Logging
    The application supports logging of informational events and errors. Solve errors fast since they are referenced to the user manual.
  • Portable
    No installation required.

* Custom list templates are not supported.
** Production environments are not supported.

Business value

As an IT service provider focused on SharePoint you have Software Engineers creating solutions for your customers. Content Generator adds additional benefit to your software development process because it enables your software engineers to develop with real world content, meaning content which is similar to your customers’ information architecture.

image

You create it once with an easy to use editor and reuse it on different SharePoint farms, e.g. development-, integration- and staging environment and / or by different software engineers.

Download

Content Generator 2010

Your opinion?

Please write me what you think… you can either post a comment below or write a mail using the contact form.

What’s next?

Of course there will be SharePoint 2010 support if the new version of SharePoint is officially released.

SharePoint 2010 - Ribbon … becoming a SP2010 developer - Part 3

The third part of my SharePoint 2010 developer learning is about the new ribbon interface. It’s available in SharePoint Foundation 2010 and SharePoint Server 2010 and offers you an easier way to manage sites. It’s also possible to extend the SharePoint 2010 ribbon with custom buttons offering additional functionality.

This is the third part of a series describing my attempt to become a SharePoint 2010 developer using available resources.

Resources

First of all here are the resources I used:

Videos

The first link includes 5 videos and the second link includes 3 videos where the first video is about the new Ribbon presented by Ted Pattison.

MSDN

Blog posts

There is also a discussion going on if sandboxed solutions are useful or not… just check the links and the comments:

Using SharePoint 2010 – Ribbon and master pages

The resources above cover a lot of things so you can add almost all kinds of extensions to the ribbon or any other menu. But where is the ribbon located and is there a difference between collaboration and publishing?

SharePoint 2010 collaboration sites

Site templates like the team site now use the v4.master which is located in the \14\TEMPLATE\GLOBAL folder.

Ribbon location in v4.master.

As you can see in the picture you need to use the SharePoint:SPRibbon tag to place the ribbon. What’s interesting here is the SharePoint:SPRibbonPeripheralContent allowing you to place content next to the tabs of the ribbon.

Ribbon user interface in a team site.

You can use Location="TabRowLeft" or Location="TabRowRight" to place additional content to the left or to the right.

SharePoint 2010 publishing sites

The publishing template uses the nightandday.master located in the \14\TEMPLATE\FEATURES\PublishingLayouts\MasterPages folder.

Ribbon user interface in a publishing site.

Here you can also place additional content next to the tabs with the method mentioned above.

SharePoint 2007 master pages

The SharePoint 2007 master pages are also installed with the 2010 version. If you manually upload e.g. the blueband.master to the Master Pages Gallery and use it with your publishing site you will miss of course the ribbon since it is not referenced in the old master pages.

Publishing page in SharePoint 2010 using a SharePoint 2007 master page destroying the layout.

Lessons learned:

Summary

Collaboration and publishing templates use the same Ribbon which can be enhanced in a lot of ways.
But the Ribbon is just one small part of a whole enhanced SharePoint 2010 UI: Master pages and page layouts with new controls and placeholders, JavaScript with the SP.UI namespace, XSLT… behind the scenes there are a lot of new things to learn.

SharePoint 2010 - Sandboxed Solutions … becoming a SP2010 developer - Part 2

The second part of my SharePoint 2010 developer learning is about Sandboxed Solutions. It ships with SharePoint Foundation 2010 and SharePoint Server 2010 and allows you to upload solutions to a site collection without the need of a farm administrator.

This is the second part of a series describing my attempt to become a SharePoint 2010 developer using available resources.

Resources

First of all here are the resources I used:

Videos and Podcast

The first link includes 5 videos and the second link includes 2 videos with Andrew Connell.

MSDN

Blog posts

There is also a discussion going on if sandboxed solutions are useful or not… just check the links and the comments:

Using SharePoint 2010 – Sandboxed Solutions

The resources above cover a lot of things but one thing wasn’t clear to me: what if I don’t use the Visual Studio 2010 SharePoint extensions?

Sandboxed or not sandboxed?

Using the Visual Studio 2010 SharePoint extensions there is a project property which decides if a solution is sandboxed or not. If you change you will get a message from Visual Studio:

Changing the project property for sandboxed solutions.

In my opinion this property only limits the code completion feature:

Limiting the code completion by setting sandboxed property to true.

There is no property in the manifest.xml file:

<?xml version="1.0" encoding="utf-8"?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/" 
SolutionId="d65c99e3-132e-4ade-b748-fe8a1b876dcf"> <Assemblies> <Assembly Location="Module 9 - Sandboxed Solutions.dll"
DeploymentTarget="GlobalAssemblyCache"> <SafeControls> <SafeControl Assembly="Module 9 - Sandboxed Solutions, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=be9c0679755f57e7
"
Namespace="Module_9___Sandboxed_Solutions.Module_9___SandBoxedWebPart"
TypeName="*" /> </SafeControls> </Assembly> </Assemblies> <FeatureManifests> <FeatureManifest Location="Module 9 - Sandboxed Solutions_Feature1\Feature.xml" /> </FeatureManifests> </Solution>

At the end the project property from Visual Studio helps the developer to implement sandboxed solutions which can run in the SPUCWorkerProcess.exe by limiting intelli sense. I think there is no other use of this property regarding the deployment process.

Deployment

How do you deploy a sandboxed solution without Visual Studio 2010?

Deploying a sandboxed and a not sandboxed solution to the farm solution store

Both is possibly. There is no difference if you install a sandboxed or a not sandboxed solution using stsadm.exe. You can also deploy both to a web application and use it.

stsadm.exe 

stsadm.exe -o addsolution
            -filename <Solution filename>
            [-lcid <language>]

C:\Users\spadmin>STSADM.EXE -o addsolution -filename Module_9___Sandboxed_Solutions.wsp

Operation completed successfully.

C:\Users\spadmin>

This example is a Visual Studio 2010 sandboxed solution which I added to the farm solution store and deployed it to a web application:

image 

Here you can see one of the video examples from above. All of the buttons with code behind can be executed which isn’t possibly if you deploy this demo to a site collections solution gallery.

image

PowerShell

You can also use PowerShell for deploying farm solutions:

SYNTAX
    Add-SPSolution -LiteralPath <String> [-AssignmentCollection <SPAssignmentCollection>]
    [-Confirm [<SwitchParameter>]] [-Language <UInt32>] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]

Deploying a sandboxed and a not sandboxed solution to the site collection solution gallery

You can’t add a sandboxed solution by using stsadm.exe. You have to use PowerShell or you have to do it manually by using the user interface.

PowerShell

SYNTAX
    Add-SPUserSolution -LiteralPath <String> -Site <SPSitePipeBind> [-AssignmentCollection <SPAssignmentCollection>]
    [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]

You can add sandboxed and not sandboxed solutions to the site collection solution gallery. Here I added a not sandboxed solution:

Adding a not sandboxed solution to the site collection solution gallery.

Note: Unfortunately I wasn’t able to add the WebPart from the solution but I think this is an other problem which I faced a few times.

Compile a sandboxed solution - tip

Here is a tip by Andrew Connell (from the second Chanel 9 video): You can compile your sandboxed solution by using a reference to the user code assembly. Now you will get an error if you are using code which can’t be run using sandboxed solutions. Don’t forget to reference the original assembly after the test.

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\UserCode\assemblies\Microsoft.SharePoint.dll

image 

Note: I used the SharePoint 2010 beta for this article.

Summary

So at the end every type of solution can be added to the farm solution store or the site collection solution gallery. It doesn’t matter. What matters is the code behind which can be executed by the w3wp.exe and the SPUCWorkerProcess.exe or not.

SharePoint 2010 - Client Object Model … becoming a SP2010 developer - Part 1

The SharePoint 2010 – Client Object Model is one of the most interesting new enhancements in SharePoint Foundation 2010 and SharePoint Server 2010. It includes 3 APIs (managed .NET, Silverlight and ECMAScript/JavaScript) allowing you to interact with SharePoint 2010 from a client which hasn’t to be run on a SharePoint server. I had some time to play around with it using resources which were available until the end of 2009.

I’m trying to become a SharePoint 2010 developer using the resources which are available. I will write down my impressions in different articles…

Resources

First of all here are the resources I used:

Videos

The first link includes 6 videos and the second link includes 3 videos with Andrew Connell.

Note: I think the first link provides videos based on SharePoint 2010 alpha or beta 1 and not the public beta… so there might be differences.

MSDN

Blog posts

Steve Peschka has written a really good series:

Using the SharePoint 2010 - Client Object Model

It’s mentioned in Steve Peschka’s series that you need to take care about the amount of data which is sent over the wire. To clarify things I tried it by myself and here are the results:

  1. The first method I have used receives 22k and includes some bad coding.
  2. The second method is optimized using a lambda expression and receives about 2k.
  3. The last method is more optimized and receives only 710 bytes.

Payloads using bad and good client object model code. 

Method 1

This method includes some unnecessary code since you don’t need to load the ‘web’, the ‘lists’ and the ‘tasklist’. You only need to use the last ctx.load() statement.

ClientContext ctx = new ClientContext(siteUrl);
Site site = ctx.Site;
Web web = site.RootWeb;
ctx.Load(web);

ListCollection lists = web.Lists;
ctx.Load(lists);

List taskList = lists.GetByTitle("Tasks");
ctx.Load(taskList);

CamlQuery query = new CamlQuery();
query.ViewXml = "<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>
Task1</Value></Eq></Where></Query><RowLimit>3</RowLimit></View>"
; ListItemCollection listItems = taskList.GetItems(query); ctx.Load(listItems, items => items.IncludeWithDefaultProperties(item =>
item.DisplayName)); ctx.ExecuteQuery();

Because of unnecessary code the payload (22k) is high compared to the other methods.

Method 2

Removing unnecessary code results in a lower payload (about 2k)

ClientContext ctx = new ClientContext(siteUrl);

List taskList = ctx.Web.Lists.GetByTitle("Tasks");

CamlQuery query = new CamlQuery();
query.ViewXml = "<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>
Task1</Value></Eq></Where></Query><RowLimit>3</RowLimit></View>"
; ListItemCollection listItems = taskList.GetItems(query); ctx.Load(listItems, items => items.IncludeWithDefaultProperties(item =>
item.DisplayName)); ctx.ExecuteQuery();

The lambda expression used in the ctx.load() statement loads all fields of a list items. If you know which columns you need you can use the third method.

Method 3

The difference is the lambda expression where you can select the properties you want to receive before you execute the query.

ClientContext ctx = new ClientContext(siteUrl);

List taskList = ctx.Web.Lists.GetByTitle("Tasks");

CamlQuery query = new CamlQuery();
query.ViewXml = "<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>
Task1</Value></Eq></Where></Query><RowLimit>3</RowLimit></View>"
; ListItemCollection listItems = taskList.GetItems(query); ctx.Load(listItems, items => items.Include(item => item["StartDate"], item =>
item["DueDate"], item => item.DisplayName)); ctx.ExecuteQuery();

The payload is 710 bytes. 

Summary

The SharePoint 2010 – Client Object Model is definitely a really cool feature since it allows you to access data from SharePoint with an application that doesn’t need to run on the server. And compared to the SharePoint 2007 beta phase there is enough documentation available to get started.