search desktop web channel mobile channel same content same page urls same site collection different...

38

Upload: james-palmer

Post on 05-Jan-2016

225 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API
Page 2: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Building Adaptive Companion Apps for Devices using SharePoint 2013Manfred Berry Rune Zakariassen Senior Dev Lead Program Manager

SPC225

Page 3: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

When You Leave you should be able to ……understand SharePoint search REST APIs

…develop adaptive companion apps

…reuse content and navigation across channels and devices

…utilize promotions and recommendations in device apps

Page 4: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Demo1 – Contoso ElectronicsWeb Storefront and the companion app

Page 5: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Search

INTERNAL ITEM CATALOGSITE COLLECTION

Electronics

DESKTOP WEB CHANNEL MOBILE CHANNEL

Same ContentSame Page URLs

Same Site CollectionDifferent layouts and templates

WEB BROWSER

REST API

NATIVE APP

Adaptive experiences allow for surfacing and adapting content for presentation through multiple channels and devices

CAMPAIGNPROMOTION

Content ReuseManaged Navigation ReuseNo additional infrastructure

We will focus here

Page 6: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

SharePoint 2013

SharePoint 2013 Remoting API

CSOM

http://<spsite>/_api

JavaScriptLibrary

SilverlightLibrary

.NET CLRLibraryREST

ODataJSON

Custom Client Code

Server

Client

Page 7: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Search REST API is protected by defaultOpt-in to allow anonymous accessThe queryparametertemplate.xml file:• Anonymous access whitelist• Search parameters• Default values

• Place in Document Library ‘QueryPropertiesTemplate’

• Configure to match current site:• FarmId, SiteId, WebId

http://server/site/_api/search/query?querytext='{queryterms}'&

querytemplatepropertiesurl='spfile://webroot/queryparametertemplate.xml'

Page 8: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Demo2 – The REST API

Sample the REST API

Page 9: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

The Windows 8/RT App

WinRTSearchClient

SharePoint

API

SearchService

CatalogDataSource

Xaml/Code behind

CatalogDataStructure

Local Cache

Contoso Electronics Native App

Soon available as code sample

Todays session samples

Page 10: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

What are we gonna do

Integrate with SharePoint Navigation

Product Category Search

Analytics Search

Usage Events

Editorial Control

Page 11: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Navigation _api/navigation/menustate?mapprovidername=‘GlobalNavigationSwitchableProvider’

Man

aged

Nav

igat

ion

Managed Navigation

Page 12: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Demo3 - Device App NavigationFirst thing to fetch is Taxonomy (from TermStore via Navigation REST API). Top level navigation tree.

Page 13: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

<?xml version="1.0" encoding="utf-8" ?><d:MenuState xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:type="SP.MenuState"> <d:FriendlyUrlPrefix>/sites/RetailPublishingPortal/</d:FriendlyUrlPrefix> <d:Nodes> <d:element m:type="SP.MenuNode"> <d:CustomProperties> <d:element m:type="SP.KeyValue">

<d:Key>Nav_Image</d:Key> <d:Value>http://………/Products/Audio.png?width=100</d:Value> <d:ValueType>Edm.String</d:ValueType> </d:element> <d:element m:type="SP.KeyValue">

<d:Key>_Sys_Facet_FullRefinementString</d:Key> <d:Value>RetPrice(…),RetBrand(…)</d:Value> <d:ValueType>Edm.String</d:ValueType> </d:element> </d:CustomProperties> <d:FriendlyUrlSegment>audio</d:FriendlyUrlSegment> <d:IsHidden m:type="Edm.Boolean">false</d:IsHidden> <d:Key>7359fa14-0054-409a-816c-22957cc49719</d:Key>

Image Rendition:Tue 10:30pm - SPC019 - Best Practices for Designing Websites with SharePoint 2013Speakers: Ethan Gur-esh and Alyssa Levitz

Navigation Properties (Images & Contextual Refiners)

_api/navigation/menustate?mapprovidername=‘GlobalNavigationSwitchableProvider’

&CustomProperties=‘Nav_Image,_Sys_Facet_FullRefinementString’Include Contextual Refinement String

Page 14: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Demo4 – Custom Properties

Managed Navigation Image Urls

Page 15: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

What are we gonna do

Integrate with SharePoint Navigation

Product Category Search

Analytics Search

Usage Events

Editorial Control

Page 16: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

User navigates – Connect navigation and search

Indexed ItemProductCatalogItemCategory:TermGuid

Node State Response<d:Nodes> <d:element m:type="SP.MenuNode"> <d:FriendlyUrlSegment>laptops</d:FriendlyUrlSegment> … <d:Key>TermGuid</d:Key></d:Nodes>

Page 17: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Executing RESTful searches

Basic queryhttp://server/site/_api/search/query?querytext='{KQL Query}'

Get all products in a categoryhttp://server/site/_api/search/query?querytext='ProductCatalogItemCategory:#GUID'&

Selecting managed propertieshttp://server/site/_api/search/query?...&selectproperties='Title,Rank, …'

Retrieving refinershttp://server/site/_api/search/query?...&refiners='RetPrice,RetColor, …'

Managed property Category GUID

Page 18: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Demo5 - Search Queries

Fetching Content and Contextual Refiners

Page 19: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

What are we gonna do

Integrate with SharePoint Navigation

Product Category Search

Analytics Search

Usage Events

Editorial Control

Page 20: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Recommendations

Built-in recommendationsEvent stream analysisItem-to-item recommendationsStored in “recommendedfor:” managed propertyUp to 12 configurable, weighted, events

Tue 3:15pm - SPC076 - Deliver Adaptive and Personalized Experiences with SharePoint 2013 - Speakers: Krister Mikalsen, Dag Eidesen

Page 21: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Recommendation Queries

Item-to-item recommendationshttp://server/site/_api/search/query?querytext='Recommendedfor:ItemId'&selectproperties='Title,Rank,etc.'...

Most popular (based on events)http://server/site/_api/search/query?querytext='contenttype:CatalogContentType'&

sortlist='ViewsRecent:descending'&………

Page 22: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Demo6 - RecommendationsItem RecommendationsRecommendedfor: attribute in query text

Page 23: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

What are we gonna do

Integrate with SharePoint Navigation

Product Category Search

Analytics Search

Usage Events

Editorial Control

Page 24: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Posting Usage Events

Log eventPOST http://server/site/_api/events/logevent

{

"usageEntry": {

"__metadata": {"type": "Microsoft.SharePoint.Administration.UsageEntry"},

"EventTypeId": 1,

"ItemId": "an itemId",

"Site": "61141c0e-4196-8123-e54eee5f4787",

"User": "johndoe"

}

}

Page 25: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Demo7 – Event Logging

How the search service learns and adapts

Page 26: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

What are we gonna do

Integrate with SharePoint Navigation

Product Category Search

Analytics Search

Usage Events

Editorial Control

Page 27: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Search

INTERNAL ITEM CATALOGSITE COLLECTION

Electronics

DESKTOP WEB CHANNEL MOBILE CHANNEL

Same ContentSame Page URLs

Same Site CollectionDifferent layouts and templates

WEB BROWSER

REST API

NATIVE APP

Adaptive experiences allow for surfacing and adapting content for presentation through multiple channels and devices

CAMPAIGNPROMOTION

Content ReuseManaged Navigation ReuseNo additional infrastructure

Page 28: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Demo8 – Editorial ControlDisplaying Promotions

Page 29: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Tips and Tricks

Page 30: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Optimize REST payloadsUse JSON payload, it is 10% smaller than XML• Accept: application/json;odata=verbose

Request only the managed properties you need in your app• use bypassresulttypes=true• and selectproperties=‘title, author, ...’

Use compression (gzip or deflate)• Accept-Encoding: gzip,deflate

Page 31: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Optimize for fluid UXCache navigation and query results locally• Protects you of network glitches and latencies

Use asynchronous patterns in your App client• More responsive and snappy UI behaviour• Allows background REST requests to services

Page 32: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Demo9 – SearchPad sampleExploring the Search REST API with SearchPad

Page 33: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Recap……SharePoint search REST APIs

…companion apps

…reuse content and navigation

…editorial control, promotions and recommendations

Page 34: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Search HOLs and events @ SPCHOL040 – Building a Product Centric Site in SharePoint 2013HOL031 – Introduction to Search in SharePoint 2013HOL034 – Exploring Search Query Rules in SharePoint 2013HOL014 – Building Windows 8 Apps with SharePoint 2013

Meet a Search and Website SME

Ask questions, meet the community and share knowledge!

Mon-Thu @ Exhibit Hall

Hands on Labs

Daily 10:30am-6:30pm @ HOL Lab Lounge

Ask the Experts

Discuss Search!Discuss Websites!

Wed 6:15PM @ Ask the Experts Lounge

Page 35: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Related Search Sessions @ SPCTue 1:45pm - SPC180Overview of Search Driven Web Sites and Cross Site Publishing in DepthSpeaker: Daniel Kogan

Tue 3:15pm - SPC076Deliver Adaptive and Personalized Experiences with SharePoint 2013Speakers: Krister Mikalsen, Dag Eidesen

Tue 1:45pm - SPC242 - Understanding OAuth, REST and OData Speaker: Ted Pattison

Wed 9:00am - SPC110Grow your Business Online with SharePoint's Adaptive ExperiencesSpeakers: Fredrik Holm, Stefan Debald

Tue 3:15pm - SPC230Step by Step: Building Search Driven Applications with SharePoint 2013Speaker: Scot Hillier

Page 36: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Evaluate this session now on MySPC using your laptop or mobile device: http://myspc.sharepointconference.com

MySPC

Page 37: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

Questions?

Page 38: Search DESKTOP WEB CHANNEL MOBILE CHANNEL Same Content Same Page URLs Same Site Collection Different layouts and templates WEB BROWSER REST API

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.