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:
- Create a (blank) site.
- Create lists to hold products and sales.
- Add product/sale data.
Create a Site
From Central Administration, I’ll create a blank site for my application. There’s only 1 user, me, AKA “Administrator”.
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.
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).
Our new site in SharePoint Designer (SPD). Already some basic security & UI functionality is provided (master-pages etc.).
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)
Let’s add a “price” field:
Now edit the column settings:
Done; the full list schema is as follows (with hidden out-of-the-box columns too):
Now do the same, but for “Sales”; making custom-field “Game Sold” a “lookup” field to “Games” as follows:
Your list should look something like:
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:
Select “Datasheet View” & enter data like you would a spread-sheet.
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”
It turns out the Munchkin cat is very popular. Who knew?
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.