Aidan Garnish

Collaboration Not Competition

Deploying an external content type from Visual Studio

When deploying an external content type created in Visual Studio from a dev to a test or production environment you may get the error:

Error 1 Error occurred in deployment step 'Add Solution': Property 'SiteUrl' contains an invalid URL. Import failed with the following exception message: The Web application at http://mydevwebapp/ could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

This issue occurs because the site url you are deploying to is now a different one. E.g. Production instead of dev.

To resolve this simply update the SiteUrl property in the feature manifest to match a valid site url in the target deployment environment:

<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/">
  <Properties>
    <Property Key="GloballyAvailable" Value="true" />
    <Property Key="SiteUrl" Value="http://myproductionwebapp/" />
  </Properties>
</Feature>

Made In Newcastle - Beyond Ships And Coal

The people of Newcastle might not be building so many ships any more but they are building lots of interesting digital products. This is the message being promoted by new web site Made In Newcastle created by Graham Miller.

It is really inspiring to see so many great ideas coming out of my home city. I'm sure that there are lots more people and businesses active in the area in addition to the ones already on the site so if you are based in Newcastle and have developed a web product or know of one worth highlighting make sure you submit it for inclusion on Made In Newcastle.

SPYam The Story So Far

After Microsoft's acquisition of Yammer it wasn't going to be long before the SharePoint community started to take a closer interest in what it was all about and the impact it was likely to have on the world of SharePoint and the Microsoft stack more generally. Last week Joel Oleson, SharePoint superstar and community organiser set up SPYam, an (initially) invitation only Yammer community to help do just that. Since then the community has grown quickly and at time of writing has 455 members. Things are still changing rapidly and with the generous help of Neil McCarthy at Yammer the account has now been upgraded to Premium level which opens up the ability to create fuller profiles, add SharePoint integration and much more.

I was interested to see how things would develop along with several other initial members who voiced concern about whether the use of Yammer for the SharePoint community would catch on. Would people be enthusiastic participants to begin with and then fade away? What advantage did Yammer provide over Twitter or Facebook? Was this just one more social tool we were going to pile on top of all the others?

It does feel like there is a lot of tyre kicking going on but this after all was one of the reasons for setting up the community. There is lots of discussion around how groups should be organised or whether topics and the use of search are a better way to organise content or should it be a combination of both? Again, this is to be expected as people find their way into using this tool which feels somewhat familiar to those of us used to other social media platforms but has it's own terminology and options for achieving specific tasks.

Where I have seen success in the past using Yammer is in project teams that are geographically spread out. Yammer was fantastic for keeping the team in contact in a lightweight way that wasn't disruptive to our working patterns in the way that a teleconference that requires everyone to be present at the same time can be. Problems could be resolved and issues could be discussed either rapidly or over a period of time and the discussions could be widened out to include other colleagues as required. The main reason for this success was the focus on a project, there was a definite need for communication around a set of project related activities. The big question for me is whether SPYam can find it's focus or purpose quickly enough to keep the members coming back for more.

Initially SPYam definitely did feel like it was a group in search of a problem to solve and the comments about whether it really had a use felt like they may be justified. However, there are increasing numbers of discussion threads emerging that are engaging multiple people and generating useful content and ideas, there are some really interesting conversations happening around SP community user groups for example. Other interesting threads have included discussion about how to measure the success of using Yammer, whether corporate focussed start-ups will have more opportunities and whether HTML is a document. As the number of participants grows, sign up is now open to anyone (just drop me an email if you would like an invite), the amount of participation should continue to build and hopefully we will end up with a really useful space for the SharePoint community to come together. It is still very early days for SPYam but I think the initial signs are encouraging that this community will have some longevity and with the release of SharePoint vNext on the horizon there should be plenty to talk about.

Lovely Beaded Lanyards, Flexible Grids and CSS Media Queries

My girlfriend Kathryn decided several months ago that she didn't like the standard lanyard that work had given her to hold her staff badge and was going to make her own beaded lanyard. After receiving positive comments about her new lanyard things have escalated and full on lanyard production and selling has commenced.

As a result I volunteered to build the ecommerce platform that would propel this beaded lanyard making enterprise to new heights. The plan was to use earlier PayPal integration experiences to enable payments and I thought it would also be a good opportunity to take a closer look at responsive web design and build a site that worked well in mobile devices.

To help achieve this I used the CSS 1140px Grid as a starting point. This is a flexible 12 column grid that uses CSS media queries to apply alternative CSS styles when the screen width of the browser drops below 767px. This allows you to create a design that is 1140px wide and then with a few tweaks to the CSS it is possible to change the look and feel of the page so that it will also display nicely on a mobile device. For this project it generally meant increasing the size of buttons and making sure there was enough padding around navigation elements for those of us with fat fingers.

CSS 1140px was great and really helped speed up development although the single break point at 767px did create some interesting results when viewing the site on a netbook but by adding another media query to the CSS most of the issues were ironed out. Having spent a bit more time researcing and working with responsive techniques I think that next time I would look at the option of designing for mobile first as this really does help you to focus on prioritising the content that is most important. It also forces you to think hard about the task the user is trying to complete on any particular page and making it as easy as possible for that task to be accomplished on smaller screens with single column layouts.

The design "philosophy" for the site was to make it as easy as possible for the user to find the lanyard they are looking for and make a purchase. This has been achieved by ruthlessly cutting out any steps that aren't 100% necessary. For example there is no need to sign up to make a purchase, in fact there is no sign up at all, ever. In addition users don't need to provide a delivery address, instead all payments are through PayPal so we use the address that is listed on the PayPal account with an option to let us know if this isn't the correct address. As a result it is possible to go from the homepage to having made a purchase with only 3 clicks on the site.

So if you are interested in seeing streamlined responsive web design in action or in a beautiful handmade beaded lanyard for yourself, girlfriend, mum, granny or sister please take a look at Pimp It Pretty.

PayPal example project C# ASP.Net

A few weeks ago I spent some time integrating PayPal Express Checkout into http://bookhashtags.com so that I could take payments for the featured book spot.

Whilst PayPal produces a lot of documentation and provides some tools to help generate code these were not always that helpful. For example the code wizard produces code that doesn't build and uses a very old version of the API which means that a lot of the things you can now do according to the documentation just didn't work and it wasn't immediately obvious why.

I have put together a bare bones Visual Studio 2010 project that will give you a quick understanding of the basics of the three Express Checkout calls (SetExpressCheckout, GetExpressCheckoutDetails and DoExpressCheckout) you need to make to get things working.

To get the project to run you will need to set up a PayPal sandbox account here - https://developer.paypal.com

You will need to add your sandbox account username, password and signature in the NVPAPICaller class.

Once that is done just press play, change the default values on the default.aspx page and hit the Pay button.

The example only adds one item and doesn't handle shipping costs. For more information on parameter names etc. see the PayPal Express Checkout Integration pdf

Download the project

 

 

Simple Linq to XML example

 string xml = "<?xml version='1.0' encoding='utf-8'?><people>"
                + "<person><id>1</id><name>Aidan Garnish</name><company>65hours</company><email>aidan@65hours.com</email></person>"
                + "<person><id>2</id><name>Joe Bloggs</name><company>65hours</company><email>Fred@65hours.com</email></person>"
                + "<person><id>3</id><name>Fred Smith</name><company>Microsoft</company><email>Joe@Microsoft.com</email></person></people>";

           

            XDocument doc = XDocument.Parse(xml);

            //filter by company and return a collection of names as strings
            var query = from person in doc.Descendants("person")
              where (string)person.Element("company") == "65hours"
              select (string)person.Element("name");

            foreach (string name in query)
            {
                Console.WriteLine(name);
            }

 

            //return a collection of objects
            var query2 = from person in doc.Descendants("person")
                    where (string)person.Element("company") == "65hours"
                    select new
                         {
                             id = person.Element("id").Value,
                             name = person.Element("name").Value,
                             email =person.Element("email").Value,
                             company = person.Element("name").Value
                         };
           
            foreach (var obj in query2)
            {
                Console.WriteLine(obj.id + " - " + obj.name);
            }           

            Console.ReadLine();

Some simple Linq to Objects examples

Linq to Objects is a really handy way to filter and order lists of objects. The following code is a simple example that shows how to filter and how to order a list by an object property.

//a little bit of object and list set up
            ContractPerson person1 = new ContractPerson()
            {   Name = "Aidan Garnish",
                AccountID = "1",
                Company = "65hours",
                Email = "aidan@65hours.com",
                Role = "SharePoint Consultant" };

            ContractPerson person2 = new ContractPerson()
            {
                Name = "Fred Smith",
                AccountID = "2",
                Company = "65hours",
                Email = "fred@65hours.com",
                Role = "Dynamics Consultant"
            };

            ContractPerson person3 = new ContractPerson()
            {
                Name = "Joe Blogs",
                AccountID = "3",
                Company = "Microsoft",
                Email = "joe@ms.com",
                Role = "Microsoft Consultant"
            };

            List<ContractPerson> people = new List<ContractPerson>();
            people.Add(person1);
            people.Add(person2);
            people.Add(person3);


            //filter list by ContractPerson.Company
            var filteredPeople = from person in people
                        where person.Company == "65hours"
                        select person;
           
            foreach (ContractPerson filterPerson in filteredPeople)
            {
                Console.WriteLine(filterPerson.Name);
            }

            //filter list by people who have a name beginning with A
            var peopleWithNameStartingA = from person in people
                                 where person.Name.StartsWith("A")
                                 select person;

            foreach (ContractPerson filterPerson in peopleWithNameStartingA)
            {
                Console.WriteLine(filterPerson.Name);
            }

            //order the list
            var orderedList = from person in people
                              orderby person.Name ascending
                              select person;

            foreach (ContractPerson orderedPerson in orderedList)
            {
                Console.WriteLine(orderedPerson.Name);
            }

            Console.ReadLine();

Book#Hashtags and PayPal integration

Quite a few people have been asking how they can support http://bookhashtags.com or have their book featured on the home page.

As a result I have combined these two things together and it is now possible for authors or publishers to feature their books on the home page by visiting http://www.bookhashtags.com/getyourbookfeatured

This was achieved using PayPal's Express Checkout API to take payment - I am thinking of writing a blog post on using PayPal Express Checkout with C# ASP.Net so if that would be useful to you please let me know in the comments. Although PayPal has a lot of documentation finding the relevant parts and putting them all together did take quite a bit of time and effort so maybe a blog post on this could save other people some pain?

Displaying a Visio 2010 drawing with links in a Page Viewer Web Part

If you have tried saving a Visio 2010 drawing as a web page and then displaying it in a Page Viewer web part in SharePoint then you will know that by default hyperlinks in the drawing will no longer work.

This is because the default output format for Visio 2010 drawings being saved as a web page is XAML. When you save the drawing as a web page a collection of files are generated one of which is called xaml_1.js. Opening the Visio drawing .htm file directly in the browser works as expected and hyperlinks are active. However, if you try to display the Visio drawing inside a Page Viewer web part you will see a JavaScript error that references the xaml_1.js file seemingly because there is conflict with DOM elements that exist in the standard SharePoint page.

I suspect that this didn't receive much attention during testing by Microsoft as the assumption could be that if you are using Visio 2010 you will also be using SharePoint 2010 and Visio Services to display your Visio drawings in the browser.

There is a way to work around this by changing the output format of Visio to VML (Vector Markup Language) instead of XAML. Unless you choose VML the first time you save as a web page then Visio remebers the XAML default and there is no setting in Visio (that I can find!) that allows you to change this default. The only option left is to crack open the registry and go searching for the relevant setting.

Open regedit and go to - HKEY_CURRENT_USER -> Software -> Microsoft -> Office -> 14.0 -> Visio -> Solution -> SaveAsWeb -> Settings then change "priformat" from XAML to VML

Save your Visio drawing as a web page again and this time it will be produced using the VML format which does not include the xaml_1.js file that causes the error and prevents links from working.

When you add the link to a Page Viewer you should now have working links.

Most Common SharePoint Application Development Mistake

SharePoint is a huge product with plenty of opportunities to make mistakes in lots of different ways. The infrastructure could be configured badly, the business may not have clearly defined what they hope to achieve with SharePoint or the information architecture is allowed to sprawl out of control.

Having worked with SharePoint for over 7 years there is one mistake that I see being repeated over and over again when SharePoint is introduced into an organisation.

Imagine the scene, SharePoint has just been installed and in this case the business do have a clear idea of what they expect from SharePoint. The first priority is to move several small legacy systems including some spreadsheets and a couple of Access database applications onto SharePoint.

The justification for this is that moving these apps to the SharePoint platform will make them easier to find and share, they will immediately fall under the SharePoint backup and disaster recovery regimes and using SharePoint as the interface will provide a more consistent user experience across all of these apps. In addition to that the business has heard all about how rapidly small applications can be developed and deployed using SharePoint and are excited to see this process in action.

Back in the IT department the .Net developers have just come back from a weeks intensive training and naturally they want to make a good impression by demonstrating their newly acquired SharePoint knowledge and showing the business what a great platform SharePoint is.

The requirements to migrate several spreadsheet based apps start to roll in and the team begin by putting together a few quick prototypes. The decision is made to move the spreadsheet contents across into SharePoint lists to take advantage of functionality like views and to be able to apply approval workflows to items.

The users of the apps take a look at the protoypes and start to provide feedback. Requests include things like:

  • Can a row be highlighted in red if some field drops below a specific number?
  • Could a link be added to the view item form that takes us straight to a specific view?
  • We don't always really like seeing the Alert Me functionality, can this be hidden for some of the lists but left on for others?

The developers know that technically they can do all of these things and they want to say yes to the business. This is a mistake.

It is a mistake for a couple of reasons. The business has been promised rapid application development by whoever sold them SharePoint. They may even have been told that this assumes you use as much out of the box functionality as possible and avoid code customisation if you can. Understandably, what they don't realise is that the things they are asking for are customisations that will require code to be written, tested, deployed and maintained.

It is up to the developers or IT managers to explain this to the business users and make it very clear whether what is being asked for is out of the box or whether it is a code based customisation.

Another reason it is a mistake is that the requests to turn off alerts or add links in unusual places are significant changes to the standard interface. One of the benefits of using SharePoint is that it provides a consistent platform and each change to that platform chips away at this consistency. The benefit of a consistent interface is that once a user has mastered one application or area of SharePoint they should be able to open any other SharePoint site and feel immediately at home. The changes mentioned may sound small but over time can build up to mean that some areas of SharePoint become almost unrecognisable. This will lead to an increase in support calls and training costs as users will be confused by these inconsistencies and ultimately this can hurt user adoption of the platform as a whole.

I'm not saying that you shouldn't use code based customisations or alter the user interface in any way but these customisations do come with an overhead that needs to be understood by the business. The danger is that if this is not clearly explained the original expectations of rapid application development and the benefits of a consistent platform are not met and the business starts to question whether these claims were ever true or even worse, whether any claim made about SharePoint is true!

An informed choice needs to be made by the business on a per application basis as to whether they are prepared to invest the extra time and effort to get an application that meets 100% of requirements. Or, decide that it is better to have something delivered far more rapidly that meets ~80% of the requirements and loses some of the nice to have elements. In addition, there also needs to be someone in the business taking an overall view of what customisations are acceptable across the platform to preserve interface consistency for the benefit of all applications.

This is clearly not an all or nothing choice and there is a sliding scale of just how much customisation the business is prepared to take on. Once people come to terms with and fully understand these choices and trade offs they usually feel much happier about SharePoint and the best way to deliver applications for their business. Ultimately SharePoint is about giving the business the tools to do a job in the most effective and efficient way possible and sometimes this means having to say no to some requirements.

What do you think? Is this something you have seen happening at companies you work with? Are there other mistakes that you see happening more frequently?