using rest to create a no code web part!
DESCRIPTION
November 11, 2011. Using REST to Create a No Code Web Part!. An introduction to REST connections Patrick Curran, MCT. Patrick Curran. MCT, MCITP , MCTS , MCP SharePoint Architect for Planet Technologies. Working with SharePoint since 2003. Administrator / Developer - PowerPoint PPT PresentationTRANSCRIPT
Using REST to Create a No Code Web Part!
An introduction to REST connections
Patrick Curran, MCT• November 11, 2011
Patrick Curran• MCT, MCITP, MCTS, MCP• SharePoint Architect for Planet Technologies.• Working with SharePoint since 2003.
– Administrator / Developer– Architect / Implementer– Troubleshooter / Brander
PCfromDC.blogspot.com @PCfromDC
Today’s Game Plan• SharePoint familiarity discussion.• Introduction to REST Connections.• Create an Address List from a predefined content type.• Tweak and modify the list to meet out needs (Demo).• Use SharePoint Designer 2010 to add a Data View Web Part to
display our Address on a new Web Part page (Demo).• Use SharePoint Designer 2010 to create a REST connection to
display the current weather in Beverly Hills, CA (Demo).• Create a data connection to display the weather of the zip code
from our Address List (Demo).
What is REST? • Really Expensive SharePoint Technology?• Stands for Representational State Transfer.• REST is not a protocol. • At its most basic element, REST is a way for a client to retrieve data
from a server over http. • SharePoint has a RESTful web service which will allow us to grab
data from lists and libraries.
Objective• To display the weather at a location that is stored in a SharePoint
list.
Let’s Get Started…• The first thing that we will need to accomplish is to create a list to
store our address.
Click on Lists
Creating “The List”
Click on Create
Creating “The List”
Click on Lists
1- Select Lists.2- Click on the list type.
3- Add a name (No spaces, We’ll fix this in a bit).
4- Click on Create when ready!
Tweaking “The List”• Now that our list has been created, let’s tweak it for our
requirements.
Click List Settings
Tweaking “The List”
2- Set the content type.1- Adjust the Title (add the spaces back).
Not part of this demo…
Tweaking “The Title”
1- Adjust the Title (add the spaces back).
Tweaking “The Title”
1- Adjust the Title (add the spaces back).
Tweaking “The Title”
No “%20” in the URLUser friendly name.
Add Content Type…
Default content type.We want to add an existing content type.
Add Content Type…1- Select List Type from Drop Down.
2- Add Contact
Add Content Type…1- Select List Type from Drop Down.
2- Add Contact
Add Content Type…OTB Content Type Columns.
Tweak The Content Type…
Our Available Content Types.Change the Default Content Type.
Tweak The Content Type…
Settings Before
Tweak The Content Type…
Settings After
Tweak The Content Type…
Change Last Name to Location
Tweak The Content Type…
Change Last Name to Location
Tweak The Content Type…
Click OK to finish
Tweak The Content Type…What Columns do we really need?
Tweak The Content Type…
What Columns do we really need?Let’s hide the one’s we do not!
Tweak The View…
Let’s edit the View
Tweak The View…
Let’s edit the View
Add An Address…
Finally, let’s go ahead and Add a new item!
Click Add new Item
Add An Address…
Add An Address…
Add An Address…
Let’s Create Our List!
Demo Time!
It’s Time To Design!Let’s open up Designer and create a page to hold our information.
1- Open your site.2- Select Master Pages.3- Select the v4.master4- Right click and select New from Master Page.
Create A Page…1- Save Page.
2- Ignore warning and click Yes
Create A Page…1- Within the PlaceHolderMain, select the Common Content Tasks.2- Click Create Custom Content
Create A Page…
1- Click inside of the PlaceHolderMain.2- Insert a 4x4 Table.
Insert Data View Web Part…
1- Click inside the Upper Left table cell.2- Insert an Empty Data View.
Insert Data View Web Part…
Insert Data View Web Part…
1- Ctrl + Click in order.2- Insert as a Single Item View from the pull-down menu.
Insert Data View Web Part…
Our list data is finally inserted!
Tweak The Web Part…Remove Paging
Paging
Tweak The Web Part…Remove the first column
Tweak The Web Part…Format Address
Let’s See Some Data!
Demo Time!
Add The Weather…Click in the 3rd table row.
Add The Weather…Add New REST Connection
1- Select Data Sources.2- Click REST Service Connection.
Add The Weather…1- Name your connection. 2- Add URL. 3- Modify Parameters.
Add The Weather…1- Modify Parameter.
Our updated Properties.
Add The Weather…
Insert REST Feed Data View into 3rd table row.
Tweak The Weather…With the Weather Web Part selected, click Add/Remove Columns.
Tweak The Weather…
Lets remove the Displayed Columns.
Tweak The Weather…Delete the description row (right click in cell).
Tweak The Weather…Change the description Format type to Rich Text.
Tweak The Weather…Ignore the Warning!
Our updated page!
Let’s See The Weather!
Demo Time!
Make The Connection…1- Select the address web part.2- Add Connection
Make The Connection…1 2
3
Make The Connection…
4 5
Make The Connection…
6 7
Tweak The Content…
Add a hyperlink to the company web site
1- Select the company name (Planet Technologies)2- Format Item as Hyperlink3- Ignore Confirmation!
Tweak The Content…Edit Hyperlink Address1- Click the function button 2- Select Web Page
Tweak The Content…
Update Address
Tweak The Content…Open hyperlink in new page1- Press the Target Frame button. 2- Select New Window as Target Frame.
Let’s See If It Works!
Demo Time!
Troubleshooting…
Additional REST Information• Important SharePoint REST Starting Point• http://[yoursharepointURL]/_vti_bin/listdata.svc/[LISTNAME] • Reference Information• Accessing SharePoint 2010 Lists using RESTful Service.- http://mstecharchitect.blogspot.com/2010/01/accessing-sharepoint-2010-lists-using.html • Referencing lists from external site collections – Cross-site collection lookup with REST and the DVWP!- http
://hamishking.wordpress.com/tag/cross-site-collection-lookup/ • SP2010: REST Data Sources within SharePoint Designer- http://
jsiegmund.wordpress.com/2010/04/25/sp2010-rest-data-sources-within-sharepoint-designer/v• Working with Data Sources and Web Services connections in SharePoint Designer 2010 (Has a list of all web services)- http
://spointblog.com/2010/02/07/working-with-data-sources-and-web-services-connections-in-sharepoint-designer-2010/• Overview of using REST in SharePoint 2010- http://www.synergyonline.com/Blog/Lists/Posts/Post.aspx?ID=35
• Lab (This is very cool)• Adding Dynamic Maps to Contact Forms with REST Web Services in InfoPath 2010.- http://msdn.microsoft.com/en-us/library/gg293117.aspx
• Background Information• Representational state transfer- http://en.wikipedia.org/wiki/Representational_State_Transfer• QuickStudy: Representational State Transfer (REST)- http://www.computerworld.com/s/article/297424/Representational_State_Transfer_REST_?
taxonomyId=16&pageNumber=1• REST Web Service- http://www.knowledgetree.org/REST_Web_Service
Thank You!!!
• Email: [email protected]• Blog: PCfromDC.blogspot.com• Twitter: @PCfromDC