Presentation is loading. Please wait.

Presentation is loading. Please wait.

Event Driven Development In Office 365

Similar presentations


Presentation on theme: "Event Driven Development In Office 365"— Presentation transcript:

1 Event Driven Development In Office 365
Amr Fouad DATACOM

2 Amr Fouad DATACOM Developer at heart*
Working with SharePoint since 2007 Now focus more on Office Development & extensibility. Office Development MVP. Twitter LinkedIn : *Not a good one though

3 Before we start, let me throw some “stuff”
Event-Notification This happens when a system sends event messages to notify other systems of a change in its domain. A key element of event notification is that the source system doesn't really care much about the response. Often it doesn't expect any answer at all, or if there is a response that the source does care about, it's indirect. There would be a marked separation between the logic flow that sends the event and any logic flow that responds to some reaction to that event.. *

4 In Summary… A System sends notification when an “event” occurs.
Source system doesn’t expect a response. Source system doesn’t really care about the consequence of the notification. *

5 Empowers separation of concerns:
So, Why It’s useful Empowers separation of concerns: Simplify code maintainability Easier to test Increase resilience and fault tolerance.

6 Let’s be more specific SharePoint On Premises SharePoint Online
Office 365

7 SharePoint On Premises
Event Receivers Deployed to the Same server No separation from architecture stand-point Feature Activated Used to provisioning / de-provisioning Requires a manual user action.

8 SharePoint Online Remote Event Receivers Webhooks
Hosted separately from SharePoint Online. List/Web RER fires once with no retries. App “Add-in” RER has 3 times retries limit (App Installed/App Uninstalled) Both will have 30 seconds execution time. Similar mechanism exists in Project Online called Remote Event handlers. Webhooks

9 Register Remote Event Receivers
Add-SPOEventReceiver Name Web/List RemoteUrl EventType Synchronization SquenceNumber PowerShell

10 Register Remote Event Receivers
POST /_api/web/eventreceivers { Name:’Event Receiver Name’, List:’List GUID’, Url:’remote URL’, EventReceiverType:’’, Synchronization:’’, SequenceNumber:’’, Web:’’ }

11 Demo: Real Business Scenario
Requirements Document ID generator Assign a tenant wide ID Control Document ID Format Prefix Sequence Year

12 Example of RER Architecture
SharePoint Online WCF Service Item Added Event Update SharePoint List Add Message to Queue Azure Storage Queue Triggered when a new message is been added

13 The world is changed New ways of doing things.

14 Webhooks Easier to develop and consume than WCF
Microsoft Ignite 2016 9/22/ :59 PM Webhooks Easier to develop and consume than WCF Basically it’s HTTP service Register using HTTP POST Request © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

15 Microsoft Graph/ SharePoint
Microsoft Ignite 2016 9/22/ :59 PM Webhooks flow Microsoft Graph/ SharePoint Notification Client Notification “HTTP POST” 200 OK POST /{version}/subscriptions User/Application © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

16 MSGraph- Create Subscription
Microsoft Ignite 2016 9/22/ :59 PM MSGraph- Create Subscription POST Content-Type: application/json { "changeType": "created,updated", "notificationURL": " "resource": "/me/mailfolders('inbox')/messages", "expirationDateTime": " T11:00: Z", "clientState": "SecretClientState" } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

17 MSGraph- Subscription Renewal
Microsoft Ignite 2016 9/22/ :59 PM MSGraph- Subscription Renewal POST Content-Type: application/json { "expirationDateTime": " T11:00: Z" } Resource Maximum Expiration Time Mail 4230 minutes. Calendar Contacts Group conversations Drive root items 86400 minutes. © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

18 MSGraph- Delete Subscription
Microsoft Ignite 2016 9/22/ :59 PM MSGraph- Delete Subscription DELETE Return 204 status when successfully deleted © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

19 MSGraph- Notification Object
Microsoft Ignite 2016 9/22/ :59 PM MSGraph- Notification Object { "value": [ { "id":"<subscription_guid>", "expirationDateTime":"\" T22:11:09.952Z\"", "clientState":"SecretClientState", "changeType":"Created", "resourceData": "Id":"<long_id_string>" } ] © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

20

21 SharePoint-Create Subscription
Microsoft Ignite 2016 9/22/ :59 PM SharePoint-Create Subscription POST /_api/web/lists('list-guid')/subscriptions Content-Type: application/json { "resource": " "notificationUrl": " "expirationDateTime": " T16:17:57+00:00" } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

22 SharePoint-Update Subscription
Microsoft Ignite 2016 9/22/ :59 PM SharePoint-Update Subscription PATCH /_api/web/lists('list-guid')/subscriptions(‘id’) Content-Type: application/json { "notificationUrl": " "expirationDateTime": " T16:17:57+00:00" } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

23 SharePoint Notification object
Microsoft Ignite 2016 9/22/ :59 PM SharePoint Notification object { "value":[ "subscriptionId":" afe b122-6c199ae89211", "clientState":" ", "expirationDateTime":" T17:27: Z", "resource":"b9f6f714-9df8-470b-b22e e1c181", "tenantId":" ", "siteUrl":"/", "webId":"dbc5a806-e4d4-46e5-951c-6344d70b62fa" } ] } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

24

25 SharePoint webhooks retry mechanism
Microsoft Ignite 2016 9/22/ :59 PM SharePoint webhooks retry mechanism Once every 5 minutes for 5 times. If your service is down for longer time , GetChanges() will be called to recover your changes since your service went down. © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

26 Microsoft Flow Built on top of Azure Logic Apps
Self-service user/team applications. Various Licensing model Doesn’t require development skills. Could be used to complement Webhooks.

27 Microsoft Flow Simple workflow Owned by Users/Teams.
Microsoft Ignite 2016 9/22/ :59 PM Microsoft Flow Simple workflow Triggers Actions Owned by Users/Teams. Needs user credentials. Mostly to automate user manual tasks. © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

28

29 Connect with me! @amr_m_fouad @ministainer
Microsoft Ignite 2016 9/22/ :59 PM Connect with me! @amr_m_fouad @ministainer © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

30


Download ppt "Event Driven Development In Office 365"

Similar presentations


Ads by Google