Aidan Garnish

Collaboration Not Competition

Twitter SharePoint Web Part With OAuth

As Twitter are about to stop allowing use of Basic Auth I have updated the Twitter friends timeline web part to use OAuth.

When you add the web part to the page you will be directed to the Twitter OAuth login page once. After that the authentication token and secret are persisted in the properties of the web part although only the token is browsable.

To change the account being displayed simply clear the Token property in the Miscellaneous section of the web part properties and you will be prompted for a new set of credentials.

As a bonus I have also included a Twitter search web part. This does not require authentication but does require you to provide a search term in the Miscellaneous section of the web part properties.

To download the .wsp SharePoint solution file visit this page.

Thanks to Shannon Whitley for his OAuth Twitter example

North East SharePoint user group meeting - Wednesday 16th June

TSG is teaming up with SUGUK to present the next user group session in the north east.

Tony Hughes from Microsoft Partner TSG who will lead us through methods to exploit Sharepoint functionality in the small to medium Sharepoint Enterprise.
 
This session bridging the technical, development and business audience will be both interactive and enlightening.  It will cover how list enhancements in Sharepoint 2010 can be deployed to allow integrated data solutions,  dip into the exploitation of Excel to create Business Intelligence, show us how to take advantage of Key performance Indicators and dashboards in Sharepoint, delve into how we can use Sharepoint Designer to create valuable data views and step into the critical realm of document management to show the importance of and approaches to document Version Control and Approval Routing.

For more information and to sign up follow this link.

JQuery Library for SharePoint

Up until now I have tended to agree with people like Jeremy Thake who warn against the use of jQuery in your SharePoint deployment. **UPDATE** - see comments from Jeremy below clarifying his position on who should be using jQuery.

However, a common requirement from users is to provide cascading drop down boxes in the new and edit item forms which SharePoint just doesn't provide out of the box.

I then came across Marc Anderson's excellent jQuery library for SharePoint which provides a solution for creating cascading drop downs as well as several other very useful functions.

Although this does not address all the issues of using jQuery I think that it helps to overcome some of them.

  1. The cascade function has already been tested for SharePoint 2010 so I know it won't break when we upgrade.
  2. It is a library which can be reused across SharePoint with minimal additional script needing to be added to individual pages so it can be maintained and updated centrally.
  3. It is a Codeplex project that is relatively popular so I can have some confidence that it will continue to be updated and even if it isn't I have a copy of the library that I can update myself if anything ever became broken in future versions of SharePoint.

 

For more information on the library and the SPCascadeDropdowns functionality take a look here.

CSS3 - rounded corners and drop shadow fun!

As IE9 is going to provide support for CSS3 I thought that it was about time I took a quick look at some of what is going to be available.

The following html and css demonstrates just how easy it is to produce rounded corners, drop shadows and gradient borders without an image file in sight -brilliant!

HTML File

<html>
<head>
<link rel="stylesheet" href="css3.css" media="screen" />   
</head>
<body>
<div class="box"></div>
<br/><br/><br/>
<div class="box2"></div>
<br/><br/><br/>
<div class="box3"></div>
<br/><br/><br/>
<div class="box4"></div>
<br/><br/><br/>
<div class="box5"></div>
</body>
</html>

CSS File

body
{
padding:20px 20px 20px 20px;
}

.box
{
-moz-border-radius-bottomleft:50px;
-moz-border-radius-bottomright:200px;
border:orange 20px double;
-moz-border-radius-topleft:100px;
-moz-border-radius-topright:66.66px;
padding:24px 24px 24px 24px;
width:320px;
height:50px;
}

.box2
{
-moz-border-radius: 1.6em;
border-radius: 1.6em;
border:black solid 1px;
height:100px;
-moz-box-shadow:-10px 10px 20px gray;
width:400px;
}

.box3
{
-moz-box-shadow:10px 10px 20px red;
-moz-border-radius: 1.6em;
border-radius: 1.6em;
border:red solid 1px;
height:100px;
width:400px;
}

.box4
{

background-color: #DAE8EC;
-moz-border-radius-topleft: 10px;
-moz-border-radius-bottomright: 10px;
border: 2px solid #B8CB99;
padding: 10px;
width:380px;
height:70px;
}

.box5
{
border: 8px solid #000;
-moz-border-bottom-colors: #555 #666 #777 #888 #999 #aaa #bbb #ccc;
-moz-border-top-colors: #555 #666 #777 #888 #999 #aaa #bbb #ccc;
-moz-border-left-colors: #555 #666 #777 #888 #999 #aaa #bbb #ccc;
-moz-border-right-colors: #555 #666 #777 #888 #999 #aaa #bbb #ccc;
padding: 5px 5px 5px 15px;
height:100px;
width:370px;
}

If you save these files and open them with Firefox 3.5 or above you should see something similar to:

 

SharePoint Custom Workflow Visual Studio Solution

There are loads of articles and blog posts about creating SharePoint 2007 custom workflows using Visual Studio but most of them only tell part of the story or have certain steps missing. Nick Swan has probably come closest with his post for Visual Studio 2005 but even with a post as comprehensive as this it is clear from the comments that it is something people still struggle with. Rather than rehash all of those posts I thought it would be more useful to provide an example Visual Studio 2008 solution that is already set up and ready to go.

This article does not aim to be a comprehensive guide to setting up a custom workflow. It is aimed at a .net developer audience who are already familiar with SharePoint and InfoPath development but who just need a bit of help bring all the bits of SharePoint custom workflow development together into a working solution.

This solution was created using STSDev v1.4 which gives a good starting point for a sequential workflow solution and automatically creates a .wsp file whenever the project is built. If you are not familiar with STSDev projects the .wsp can be found in the Deployment folder of the project.

In the project I have included the more common generic elements for a custom SharePoint workflow:

  • An InfoPath initiation form that allows the user to provide information to the workflow task. In this case the workflow task title is set and a property is stored to be displayed later on the task form.
  • An InfoPath task form that displays information from the initiation form and allows the user to approve or reject the the item.
  • The sequential workflow itself - wiring this up is often a place where people miss something or make mistakes.
  • A WorkflowTestInitForm.cs file that is used to make the information typed into the initialisaton form available in code. See comments in this file to generate your own.
  • An ItemMetaData.xml file that is used by the InfoPath task form as a secondary data source so that the information supplied by the initiation form can be displayed.

The code has been commented to provide additional information and guidance on how to set up your own workflows. For the solution to work the only thing you have to change before building and deploying the .wsp is line 62 in SequentialWorkflow01.cs - the task assigned to property must be set to a user that is valid for your environment.

To open the solution just save this zip and extract in your development environment - AidanWorkflowTest.zip (91.97 kb)

SharePoint Customisation - OOTB vs SPD vs Custom Code

@joyknows has posed an interesting SharePoint question via Twitter -

What would you say are the primary strengths and weaknesses of OOTB customisation vs. SPD vs custom code?

This one is definitely going to take more than 140 characters so here goes...

Out of the box (OOTB) customisation allows any end user familiar with SharePoint to create sites, lists and web parts through the user interface to produce something that meets their specific requirements.

Strengths -

  • Very quick to create customisations
  • Anybody with basic SharePoint knowledge can do it
  • Forces users to create solutions in a "SharePoint way" which encourages consistency

Weaknesses -

  • Doesn't provide much flexibility - compromises have to be made with requirements
  • If you want to repeat the same customisations again then options for recreating the solution are limited - manual repetition of creation steps or templates

SharePoint Designer (SPD) customisation allows power users to get a bit more creative and make use of some of the more advanced options in SharePoint such as custom workflows and connecting to differnt data sources.

Strengths -

  • More options for customisation - will fulfill more of the original requirements
  • Make changes to master pages and page layouts - create a completely new look and feel

Weaknesses -

  • Difficult to deploy customisations made using SPD to other sites - eg. A custom workflow created in SPD is applied to a specific list and cannot be resused on another list. The only option is to manually recreate the workflow again for the next list.
  • It is possible to do a lot of damage very quickly if put into untrained hands
  • Once files are customised by SPD they cannot be changed by custom code

Custom code requires a SharePoint developer to write it but it is the most powerful option that opens up the full SharePoint API, web services and any other code you want to use to customise your solutions.

Strengths -

  • Provides the most options for customisation
  • Customisations can be packaged up as features that are easily deployed and reused in multiple solutions
  • Deployment can be controlled and governed more easily as customisations can only be deployed by people with SharePoint admin permissions

Weaknesses -

  • Requires a SharePoint developer
  • Takes longer to achieve the same results

The above lists are a very brief summary of the pros and cons for each option. In reality it would be possible to have lengthy discussions about each but I think these lists provide a fair summary that should help as a primer for the more important discussion - which option should I choose?

As with most decisions like this the short answer is - it depends. In this case it depends largely on the trade off that you are prepared to make between speed of solution develoment and flexibility/meeting the original requrements exactly.

If you need something fast and are prepared to compromise by not meeting the original requirements 100% perfectly then OOTB is the way to go.

If, on the other hand, you need to have a solution that ticks off every requirement perfectly, that can be easily reproduced across lots of sites and you are prepared to wait a bit longer for delivery then custom code is the answer.

SharePoint Designer is a middle ground that combines the best and worst of all the options. In my opinion it should only be used to quickly prototype something that you later turn into a well packaged custom code solution or where you have to customise to meet a requirement but do not have SharePoint development resources available.

In the interests of full disclosure I am from a SharePoint development background and have also spent a significant amount of time working with SharePoint whilst being constrained to only using OOTB customisations. As a result I am not what I would describe as a typical SharePoint dev - ie. Reach for Visual Studio first and ask questions later!

This may sound like a betrayal of my SharePoint developer brothers and sisters but I would argue that custom code should only be used once you are sure that what is being asked for cannot be achieved using OOTB customisation. That may sound obvious but it is easy to take requirements on face value and assume that what the end user is asking for cannot be compromised on which makes it look as though custom code is the only option. In reality if the end user understands that they can have a solution that meets 80% of the requirements delivered in 2 days using OOTB or a solution that meets 100% of the the requirements in 10 days using custom code those requirements that were previously set in stone suddenly become a bit more flexible.

So in summary, and just to be clear so I don't get flamed by all the SharePoint devs, custom code is great. It provides the most number of customisation options that can be deployed to your SharePoint farm in a repeatable and controlled way. However, I would choose OOTB wherever possible in the interests of speed of delivery and productivity even if that means using your powers of persuasion to talk the end user into settling for a solution that doesn't tick off 100% of the original requirements but does meet the core ones, they will thank you in the end!

SharePoint support turns from a trickle to a flood

When Microsoft Office SharePoint Server 2007 was in beta, and for some time after it was given a full release, the level of support and documentation available was, at best, pretty sketchy. Over time Microsoft have improved what is available on MSDN and Technet as well as publishing best practices but what really saved MOSS 2007 and the people who work with it was the SharePoint community who have done a great job in supporting each other with blog posts, forums, wikis, white papers and the like.

Given that history, it is fantastic to see the amount of information being made available before the public beta of SharePoint 2010 is even released. As the NDA on SharePoint 2010 was lifted at the SharePoint conference in Las Vegas there was a veritable blizzard of blog posts from various SharePoint insiders.

Other than watching the SharePoint conference key note one of the best summaries of top new features came from Joel Oleson and also includes further links to the MSDN and Technet documentation for SharePoint 2010 as well as what looks like quite a promising Developer Centre being created by Microsoft that is currently tagged as in beta. Joel has also started doing some presentations on the new admin features of SharePoint 2010 with further information on his blog.

Andrew Connell was quick off the mark with 3 blog posts on improvements to the Web Content Management aspects of SharePoint 2010 and a further post on the new service application architecture.

Bil Simser filled in some of the details around improvements to look up columns and the addition of ratings functionality.

Spencer Harbar has produced a great post on the improvements to the development tools available for SharePoint 2010 which will all be very welcome given the amount of criticism Microsoft got from the development community for not doing more in this area for the previous version.

Another brilliant developer post on the factors that could persuade asp.net developers to start using SharePoint comes from Jeremy Thake the man behind SharePoint Dev Wiki. This is a wiki that was started as a reaction to the lack of a definitive resource for SharePoint developers and has become the place to go for reference material and guidance on SharePoint development. The site has now been extended to include a SharePoint 2007 Administration wiki and a shiny new SharePoint 2010 Development wiki which is already starting to be filled with content.

A communication method that wasn't available when the 2007 version was released was Twitter. Not being able to go to the SharePoint conference was frustrating but Twitter came to the rescue and at times it was almost like being there. Well, ok, maybe not but it did provide a rich stream of information about new features directly from the people who were lucky enough to be there. This allowed the people who couldn't be there in person to get a glimpse of some of the detail being revealed during the sessions and to see beyond the headlines of the keynote.

Back in the beta days of SharePoint 2007 it was often a case of feeling your way and piecing together bits of information from lots of different sources to achieve the end result you were looking for. I think I can say with some confidence that those bad old days are in the past for SharePoint. It is now a huge success story for Microsoft and they are supporting it better than ever with documentation and tools. In addition the community of people working with and supporting SharePoint has grown massively over the last few years and this is where a lot of the best content is going to come from. This time round the problem won't be the lack of information the issue will be that now the trickle has turned to a flood can we keep up with all the content being produced? This is where inititiatives like Dev Wiki can really help to put some structure to that content and also allows us to give authority to the best bits.

Have you come across any other great SharePoint 2010 posts that are worth sharing? If so please add them in the comments.

Easily import data from CSV and SQL to a SharePoint list

CSV and SQL importer wsp file

This SharePoint feature allows you to quickly import data from a CSV file or a SQL stored procedure to any custom SharePoint list.

Once you have added the solution to your farm and activated it on your site collection an additional menu option will be available on the Action menu of each custom list that will take you to the import CSV or SQL page.

Simply select which option you want - either import from a CSV file or import from a SQL stored procedure. Next, browse to the CSV file or enter the SQL connection and name of the stored procedure and hit the Import button.

There is a check box option to delete all items from the list before doing the import which is not selected by default.

IMPORTANT - the first line of the CSV file must contain the names of the SharePoint list columns you want to import the data to. Eg. If you want to import data into a list that has two columns called Title and Description then the first row of the CSV file will be Title, Description.

If you are using SQL then the stored procedure for the example above would need to be something like: SELECT Title, Description from [TableName]

**UPDATE 16/12/2012 - I have now updated the CSV Upload portion of this feature to work as a SharePoint 2013 Hosted Solution.

A Manager's Guide to SharePoint

A manager's guide to SharePoint is a non-technical white paper explaining concepts of deploying and maintaining a SharePoint implementation. This free, thirty-six page eBook gives a broad overview, covering critical topics when planning your SharePoint implementation.

This is an extremely well put together overview of SharePoint and the best practice approach for implementing it in any organisation. In my opinion, an essential read for all managers considering deploying SharePoint.