Date post: | 28-Mar-2015 |
Category: |
Documents |
Upload: | barrett-robinson |
View: | 224 times |
Download: | 0 times |
22 мая 2013, Киев
Построение Windows 8 приложений для доступа к SharePoint 2013
Бельский Сергей
2
Agenda
• Getting started with Windows 8 Apps• Which SharePoint APIs are suitable?• Binding SharePoint data• Searching SharePoint• Notification
What is a Window 8 app?
3
4
Touch First
• No chrome – full screen experience• Designed for Touch and Pen input
5
What is a Windows 8 app?
• Full screen window with multiple views• Supports touch and works great without• Runs on a variety of devices• Sandboxed• Uses tiles instead of icons• Can be distribute via Windows Store
6
Why Windows 8 App and SharePoint?
• Great way to visualize data• Business Intelligence• Charts / Graphs• Reports
• Brings SharePoint to the Desktop• Executives love “touch”• Great app opportunity• Easy to develop
Getting Started
7
8
Getting Started - Environment
• At least two machines required• Server running SharePoint 2013
• SQL, Active Directory, Workflow, WAC optionally on other servers• Client running Windows 8
• Pro or Enterprise works best
• Ideally both machines are on the same domain
9
Getting Started - Server
• Windows Server running SharePoint 2013• Visual Studio not required• More memory is ideal
10
Getting Started - Client
• Client running Windows 8• Pro or Enterprise ideal• Connected to same domain
• Visual Studio 2012 RTM• 2 GB – 4 GB of memory• Internet connection required
11
Which Language?
• HTML5 + JavaScript• XAML with C#, Visual Basic, or C++ code-behind• DirectX with native C++ and HLSL
DEMO Simple App. Simulator
12
13
SharePoint Integration Points
• Authorization • Data binding• Contracts• Search
• Live Tiles• Notification
Authorization
14
15
Authorization
DEMO Authorization to the office 365
16
Data binding
17
18
Data binding steps
• Retrieve data from SharePoint• Bind data to default view model• Customize template
19
SharePoint 2013 APIs
• RSS• Client Script Object Model• Web Services• REST
20
What’s covered in the new CSOM/REST APIs?
BCSIRM
AnalyticsWorkflow
eDiscoveryPublishing
TaxonomySocial
Sharing
Search
And much, much more!
21
Why is REST the best choice?
• Simple and Easy to Use• Much easier to use than SOAP-based Web service• Higher productivity when using JavaScript and jQuery• Results can be returned in JSON and ATOM format• Test in a browser
22
ODATA URIs
• URI has three significant parts• Service root URI• Resource path • Query string options (select, filter)
23
REST URLs in SharePoint 2013
JavaScript Library
Silverlight Library
.Net CLR Library
Custom Client Code
Client
Server
_api is new alias for _vti_bin/client.svc
RESTODataJSON
CSOM
24
Mapping Objects to Resources
• Example REST URLs targeting SharePoint sites_api/web/lists
_api/web/lists/getByTitle('Announcements')
_api/web/lists/getByTitle('Announcements')/$select=title,body,expirationdate
25
Response XML
26
ATOM XML or JSON?
• Response data format selected with ACCEPT header• XML can be easier to deal with from managed code• To get ATOM XML response use "application/atom+xml"• JSON is easier to deal with when using JavaScript• To get JSON response use "application/json"
27
REST Queries from Windows 8 Apps
• Use HttpClient object to GET SharePoint data• Use HttpClientHandler object for authentication• Add headers to request data in ATOM XML format• Parse data with LINQ to XML
28
Data Templates
• Bind data to SharePoint fields• Change look and feel of results• Can be defined in:• Page.Resources• StandardStyles.xaml
<DataTemplate x:Key="Standard250x250ItemTemplate"> <Grid HorizontalAlignment="Left" Width="250" Height="250"> <Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}"> <Image Source="{Binding Image}" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/> </Border> <StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}">…
29
Package.appmanifest
• Specify information about your app• i.e.: Name, logo, supported orientations, splash screen
• Declares capabilities your app requires• SharePoint typically requires:• Enterprise Authentication (not for office 365)• Internet (Client)• Private Networks (Client & Server) (not for office 365)
DEMO Data binding a document library using REST + JSON
30
App Contracts
31
32
What is App Contract?
• An agreement between one or more apps• Built with special Visual Studio project items
File PickerPlay ToSearchShareSettings
33
Search Contract
• Great for SharePoint• Add SharePoint Search to the Charms menu• Touch friendly interface• App automatically launched if not open• Can be activated on keyboard input
34
Creating a Search Contract
• Use Search Contract Project Item• Query search via REST• Format XML into expected format• Bind results to this.DefaultViewModel[“Results”]
35
Searching SharePoint
• Search Web Service deprecated• REST API preferred query method• Search REST URL
DEMO Searching SharePoint documents from Windows 8 App
36
Tiles and Notification
37
38
Tiles
• Combination of text and images• Defined by XML• 34 Templates Available• Can be updated by app
39
Tiles come in all shapes and sizes
40
Tile XML
<tile> <visual> <binding template="TileSquareBlock"> <text id="1">Text Field 1</text> <text id="2">Text Field 2</text> </binding> </visual></tile>
<tile> <visual> <binding template="TileWideImageAndText01"> <image id="1" src="image1.png" alt="alt text"/> <text id="1">Text Field 1</text> </binding> </visual></tile>
41
Apps can notify users with
• Tiles• Badges• Toast• Lock Screen
42
Types of notification
• Periodic• Polling – occurs at regular intervals until stopped• Scheduled – occurs at a scheduled time
• Push
43
Strategy for updating Tiles with SharePoint
• No client side code executed when polling Tile XML• Avoid custom code in SharePoint• Solution: Custom RSS
DEMO Notification
44
45
Resources
Windows 8 Apps + new Office 365 (SharePoint Online)http://blogs.msdn.com/b/omarv/archive/2012/10/25/windows-8-store-apps-office-365-enterprise-preview-sharepoint-online.aspx
My technical bloghttp://blogs.msdn.com/b/sergey_belskiy_technical_blog/
Programming using the SharePoint 2013 REST servicehttp://msdn.microsoft.com/en-us/library/fp142385.aspx