As described in our original scenario, we want to create of list of Client Names so that we can ultimately associate our OneNote notebook with one of them.
This list can be thought of as a standard Lookup list, as well as a repository for Client information. The Client Name will be used to fill dropdowns in other list columns or forms, but also provides a 1-click way for a user to see more detailed information about a Client associated with another item. I’ll show you what I mean, but first let’s create the list. You can use any of the following methods:
- The Standard Way
- The Import Way
- The SharePoint Designer Way
- The PowerShell Way
- The Visual Studio Way
- The External Content Type with Azure Way
Choose the option that works best for you – let’s begin! (click on images for larger views):
The Standard Way
If you want to keep things simple and in-browser, the standard approach is to Create a new custom list, then add new columns to the list. In SharePoint 2010 you start by going into the Site Actions menu. In SharePoint 2013 you use the Site Actions Gear icon:
Both SP2010 and SP2013 allow you to create a Custom List, but in SP2013 you create it by adding an App:
Once your Custom List [App] is created, you can now add your columns: Client Name (just rename the Title column), Website URL (a hyperlink column), and Point of Contact (Single Line of Text).
Once your list is created and your columns are added, you can add items/rows to the list with the Add Item button, or by using the Quick Edit (aka Datasheet) feature to add them like you would in Excel:
The Quick Edit or Datasheet button can be found in the Ribbon:
It gives you a spreadsheet-style view of your data:
The Import Way
Speaking of spreadsheets, using SharePoint’s Import Spreadsheet feature is also a convenient way to create a new list. Not only can you quickly add new data rows, but it also gives you a way to quickly create new Columns simply by using your row headings:
Be sure to double-check and make sure Excel has properly identified the Types to be used for your columns. In the case of our List, it has:
(Make sure you spread the word about the Import option – it’s a great way to increase SharePoint adoption in your organization)
The SharePoint Designer Way
Some people like using SharePoint Designer to create or edit a List because they like the Desktop-app responsive feel, versus the sometimes-laggy browser UI. If you fall into that category, you can create a new List in SharePoint Designer easily using the SharePoint List dropdown button.
Then, you can quickly add new columns to your list, choosing the column type from the drop-down:
The PowerShell Way
If you’re good with PowerShell, you like automating your tasks, or you just like the speed with which a PowerShell script can work within the SharePoint object model, here’s a quick example of a PowerShell script that can create our “Client Names” list, including an example of adding a column:
1: $spWeb = Get-SPWeb -Identity http://myservername
2:
3: $listtemplate = [Microsoft.SharePoint.SPListTemplateType]::GenericList
4: $spWeb.Lists.Add("Client Names","Description",$listtemplate)
5:
6: $spList = $SpWeb.GetList("/Lists/Client Names")
7: $spList.Fields.Add("Point of Contact", [Microsoft.SharePoint.SPFieldType]::Text,$false)
The Visual Studio Way
For all you developers, you also have the option of creating your custom List using Visual Studio. Simply start up a new SharePoint Project solution, and add a new List item to your project. Visual Studio provides an interface for specifying the columns and column types for your List:
This approach is a good one for those who are automating the creation of many lists, possibly across many sites. Or, this may be a required option if your organization insists that your site artifacts be source-controlled in a system like Team Foundation Server. Below, I’ve added my new Custom List project to my cloud-based TFS source control account:
(fyi - I previously blogged about this hosted TFS service here, though that service is no longer in Preview)
The External Content Type with Azure Way
Everyone knows that SharePoint can easily pull data from other systems like databases. These days, SharePoint and Azure integration is also becoming an increasingly popular architectural choice. In our scenario, what if our Client names list could be found in an external SQL database “in the cloud”? We can try this out by quickly create a simple database in Azure. You can see in my Database Management portal below that my DB is ready to go:
I’ve also already added columns, and some data as well:
Now, in SharePoint Designer I can create a new External Content Type, using my Azure database as a data source:
After making the necessary tweaks to credentials in the Secure Store Service, and setting the necessary object permissions, I now have an External List that looks and behaves just like a standard List. Plus, any edits I make to this list get written back to my Azure-managed SQL Database:
I just heard someone out there ask “why would I want my list to come from external data?” Well, I could think of lots of reasons, but one of the best in this case would be if you were trying to connect to your organization’s [on-premise or cloud-based] CRM system to get a real-time list of Clients. Or, thinking even outside of SharePoint, perhaps I simultaneously want to use this Azure data for a mobile app I’ve created for my HTC Evo 4G LTE – with the data being stored in Azure, it’s now available to my phone app as well as my SharePoint site.
Well, we’ve discussed more ways to create a List than you ever thought you wanted to know. : ) But we’ve still got more to do to get our OneNote notebook integrated with all this data. Stay tuned for Part 3.
No comments:
Post a Comment