SharePoint 2010 Apps for n00bs – Data and Lists


We’ll start off by running through the very fundamentals of any application – storing data in lists, with some basic interfaces to get & set the data too. In SharePoint land, unlike SQL, we always have a basic interface to any list with the out-of-the-box forms SharePoint will provision for any given list store. This is nice because sometimes writing a GUI for doing it ourselves can be a pain, especially if you rarely ever want to interact with the list so can’t be bothered to write one especially. Incidentally all lists will always have automatically various web-service interfaces to interact with them too, but that too is for another day.

There are many types of lists – Document Libraries you’ve probably heard of for example, but all lists effectively inherit from a base “List” implementation so that’s what we’re going to build for now.

This workshop & the one on reports is also in video form – https://youtu.be/iyQmam_fvdg

Steps to Build a SharePoint Application

There’s multiple ways to build things in SharePoint. The most common & easiest way is to use the web GUI to do it so that’s how we’re going to start; later I’ll dive into how to programmatically do the same but for now it’s a case of:

  1. Create a (blank) site.
  2. Create lists to hold products and sales.
  3. Add product/sale data.

Create a Site

clip_image008

From Central Administration, I’ll create a blank site for my application. There’s only 1 user, me, AKA “Administrator”.

clip_image010

My rather barren looking site. Even with the “blank” site we get various master-pages and a default page as seen above; if a site was truly blank, you wouldn’t see anything in a browser. You could think of the different site-types as different application templates – we want enough functionality that we can use the default SharePoint GUI to play around and create more things, but little else.

Create lists

I’ll do the next bit in SharePoint Designer 2010 (free download, also called “SPD” for short) as it’s just quicker. From SPD click “Open Site” and enter the URL of your new site, in this case http://sfb-ntlm-ad:39712/sites/PetStore (or you can click “Open in SharePoint Designer” from the web-browser site-actions menu).

clip_image012

Our new site in SharePoint Designer (SPD). Already some basic security & UI functionality is provided (master-pages etc.).

clip_image014

In “Lists and Libraries” we want to create two custom lists, “Inventory” and “Sales” – custom just means “blank” in this instance.

Once you’ve created both, let’s edit one. Click on it in the list (of lists), then click the toolbar button “Edit Columns” to add any missing columns (“Title” & others are created by default)

clip_image016

Let’s add a “price” field:

clip_image018

Now edit the column settings:

clip_image020

Done; the full list schema is as follows (with hidden out-of-the-box columns too):

clip_image022

Now do the same, but for “Sales”; making custom-field “Game Sold” a “lookup” field to “Games” as follows:

clip_image024

Your list should look something like:

clip_image026

Note: I renamed “Title” to “Customer Name” as all lists in SharePoint-land have to have a title field as every list inherits from a base content-type “Item” which has this field, but more on that another day. In short, you have to have it in one form or another, even if you don’t use it. Apart from that I’ve set “Sale Date” to default to today’s date and “Quantity” to default to “1”.

Now you’re done in SharePoint Designer. You can do the exactly same list-creation process via the browser too, but just because there’re fewer clicks so I chose to do it in SPD.

Add some data

I’ll do this in the GUI; there’s a great datasheet view that speeds this up greatly. This is one of the many things that come even with blank sites, but more on that later.

Open/refresh the homepage again, navigate to the Inventory list and then click:

clip_image028

clip_image030

Select “Datasheet View” & enter data like you would a spread-sheet.

clip_image032

Please note, I have no idea how much dogs/cats actually cost, however I did learn there is such a thing as a “Munchkin cat”. You learn something every day, thanks Wikipedia.

Now do the same for “sales”

clip_image034

It turns out the Munchkin cat is very popular. Who knew?

Wrap-Up

You’ve created your first lists to store and link data – well done! It’s not rocket-science of course but it is important obviously, and this is just the absolute very basics. What we’ve done here you can automate of course – the same way you don’t need a GUI to create SQL Server tables, and as for the data-input/forms of the data mentioned – don’t worry if you don’t like them, you can change them but we’re looking at that separately in the “Forms” demo where we’ll customise and modify the forms SharePoint has given us by default, but for now just getting a reasonable schema in and some data will be enough.

Comments (0)

Skip to main content