/
sharepoint.yml
831 lines (809 loc) · 26.7 KB
/
sharepoint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
category: File Storage
configPages:
- elements:
- type: configVar
value: Microsoft Sharepoint Connection
- type: configVar
value: Acme API Endpoint
name: Connections
tagline: ""
- elements:
- type: configVar
value: Sharepoint Drive
- type: configVar
value: Select Site
name: Configure Sharepoint
tagline: ""
userLevelConfigured: false
definitionVersion: 7
description: "Automatically sync files from your Sharepoint drive, plus other actions."
documentation: >-
## SharePoint Example Integration
This integration contains five flows:
## Import SharePoint File on Event
Whenever a file is created/updated/deleted in your customer's selected
Sharepoint drive, that file is fetched and uploaded to an "Acme" endpoint that
your customer enters.
## Subscribe to SharePoint File Events
This flow runs every week and creates a subscription to a Sharepoint drive,
instructing Sharepoint to send notifications to the **Import SharePoint File
on Event** flow whenever files are updated.
## Run Subscription Flow on Deploy
This flow calls the **Subscribe to SharePoint File Events** once on instance
deploy to ensure the subscription is configured immediately.
## Get Files from SharePoint
This is a synchronous flow that can be called from an external system to list
files in a SharePoint drive.
## Fetch Events and Documents from Site Lists
This flow demonstrates how to fetch "lists" in a SharePoint site,. A "list"
can represent a calendar of events or a directory with files in it.
endpointType: flow_specific
flows:
- description: ""
endpointSecurityType: customer_optional
isSynchronous: false
name: Import Sharepoint File on Event
steps:
- action:
key: webhook
component:
isPublic: true
key: ms-sharepoint
version: LATEST
branches:
- name: Notification
steps:
- action:
key: getInstanceValue
component:
isPublic: true
key: persist-data
version: LATEST
description: ""
inputs:
defaultValueInput:
type: value
value: latest
keyInput:
type: value
value: onedrive_delta_token
name: Get Delta Token
- action:
key: listChanges
component:
isPublic: true
key: ms-onedrive
version: LATEST
description: ""
inputs:
$expand:
type: value
value: ""
$select:
type: value
value: ""
$top:
type: value
value: ""
deltaURL:
type: template
value: >-
/drives/{{#Sharepoint
Drive}}/root/delta?token={{$getDeltaToken.results}}
oneDriveConnection:
type: configVar
value: Microsoft Sharepoint Connection
name: List Changes
- action:
key: runCode
component:
isPublic: true
key: code
version: LATEST
description: ""
inputs:
code:
type: value
value: >
module.exports = async ({ logger, configVars },
stepResults) => {
const url = new URL(stepResults.listChanges.results["@odata.deltaLink"]);
const token = url.searchParams.get('token');
return { data: token };
};
name: Get New Delta Token
- action:
key: loopOverItems
component:
isPublic: true
key: loop
version: LATEST
description: ""
inputs:
items:
type: reference
value: listChanges.results.value
name: Loop Over Items
steps:
- action:
key: branchOnExpression
component:
isPublic: true
key: branch
version: LATEST
branches:
- name: A file was deleted
steps:
- action:
key: writeLog
component:
isPublic: true
key: log
version: LATEST
description: ""
inputs:
level:
type: value
value: info
message:
type: template
value: >-
The file with ID
"{{$loopOverItems.currentItem.id}}" was
deleted.
name: Log deleted file's ID
- name: A file was created or updated
steps:
- action:
key: getFile
component:
isPublic: true
key: ms-sharepoint
version: LATEST
description: ""
inputs:
connection:
type: configVar
value: Microsoft Sharepoint Connection
driveId:
type: configVar
value: Sharepoint Drive
itemId:
type: reference
value: loopOverItems.currentItem.id
name: Get File
- action:
key: httpPostFormData
component:
isPublic: true
key: http
version: LATEST
description: ""
inputs:
connection:
type: configVar
value: ""
debugRequest:
type: value
value: "false"
fileData:
type: complex
value:
- name: file
type: reference
value: getFile.results
fileDataFileNames:
type: complex
value:
- name: file
type: reference
value: loopOverItems.currentItem.name
formData:
type: complex
value:
- name: fileId
type: reference
value: loopOverItems.currentItem.id
- name: driveId
type: reference
value: >-
loopOverItems.currentItem.parentReference.driveId
headers:
type: complex
value: []
httpMethod:
type: value
value: post
ignoreSslErrors:
type: value
value: "false"
includeFullResponse:
type: value
value: "false"
maxRetries:
type: value
value: "0"
queryParams:
type: complex
value: []
responseType:
type: value
value: json
retryDelayMS:
type: value
value: "0"
retryOnAllErrors:
type: value
value: "false"
timeout:
type: value
value: ""
url:
type: configVar
value: Acme API Endpoint
useExponentialBackoff:
type: value
value: "false"
name: Send file to Acme
- name: Else
steps:
- action:
key: writeLog
component:
isPublic: true
key: log
version: LATEST
description: ""
inputs:
level:
type: value
value: info
message:
type: template
value: >-
The folder
"{{$loopOverItems.currentItem.name}}" now has
{{$loopOverItems.currentItem.folder.childCount}}
files in it.
name: Log number of folder child items
description: ""
inputs:
conditions:
type: complex
value:
- name: A file was deleted
type: complex
value:
- and
- - exists
- type: reference
value: loopOverItems.currentItem.deleted
- name: A file was created or updated
type: complex
value:
- and
- - exists
- type: reference
value: loopOverItems.currentItem.file
name: Check type of event
- action:
key: saveInstanceValue
component:
isPublic: true
key: persist-data
version: LATEST
description: ""
inputs:
keyInput:
type: value
value: onedrive_delta_token
valueInput:
type: reference
value: getNewDeltaToken.results
name: Flow - Save Value
- name: URL Validation
steps:
- action:
key: stopExecution
component:
isPublic: true
key: stop-execution
version: LATEST
description: ""
inputs:
contentType:
type: value
value: application/json
jsonBody:
type: value
value: ""
statusCode:
type: value
value: "200"
name: Stop Execution
description: ""
inputs: {}
isTrigger: true
name: Sharepoint Webhook Trigger
- description: ""
endpointSecurityType: customer_optional
isSynchronous: false
name: Subscribe to Sharepoint File Events
steps:
- action:
key: schedule
component:
isPublic: true
key: schedule-triggers
version: LATEST
description: ""
inputs: {}
isTrigger: true
name: Webhook/Subscriptions Trigger
schedule:
meta:
scheduleType: week
timeZone: ""
type: value
value: 00 00 * * 0
- action:
key: deleteAllInstanceSubscriptions
component:
isPublic: true
key: ms-sharepoint
version: LATEST
description: ""
inputs:
connection:
type: configVar
value: Microsoft Sharepoint Connection
name: Delete All Instance Subscriptions
- action:
key: getCurrentDateTime
component:
isPublic: true
key: datetime
version: LATEST
description: ""
inputs: {}
name: Get Current Date/Time
- action:
key: adjustDateTime
component:
isPublic: true
key: datetime
version: LATEST
description: ""
inputs:
dateTimeInput:
type: reference
value: getCurrentDateTime.results
daysInput:
type: value
value: "7"
hoursInput:
type: value
value: ""
minutesInput:
type: value
value: "5"
secondsInput:
type: value
value: ""
name: Add 7 Days
- action:
key: createSubscription
component:
isPublic: true
key: ms-sharepoint
version: LATEST
description: ""
inputs:
allowDuplicates:
type: value
value: "true"
changeType:
type: value
value: updated
clientState:
type: value
value: ""
connection:
type: configVar
value: Microsoft Sharepoint Connection
expirationDateTime:
type: reference
value: add7Days.results
notificationUrl:
type: reference
value: >-
webhookSubscriptionsTrigger.results.webhookUrls.Import Sharepoint
File on Event
resource:
type: template
value: "/me/drives/{{#Sharepoint Drive}}/root"
name: Create File Subscription
- description: ""
endpointSecurityType: customer_optional
isSynchronous: false
name: Run Subscription Flow on Deploy
steps:
- action:
key: instanceDeploy
component:
isPublic: true
key: management-triggers
version: LATEST
description: ""
inputs: {}
isTrigger: true
name: Run Subscription Flow on Deploy Trigger
- action:
key: httpGet
component:
isPublic: true
key: http
version: LATEST
description: ""
inputs:
connection:
type: configVar
value: ""
debugRequest:
type: value
value: "false"
headers:
type: complex
value: []
ignoreSslErrors:
type: value
value: "false"
includeFullResponse:
type: value
value: "false"
maxRetries:
type: value
value: "0"
queryParams:
type: complex
value: []
responseType:
type: value
value: json
retryDelayMS:
type: value
value: "0"
retryOnAllErrors:
type: value
value: "false"
timeout:
type: value
value: ""
url:
type: reference
value: >-
runSubscriptionFlowOnDeployTrigger.results.webhookUrls.Subscribe
to Sharepoint File Events
useExponentialBackoff:
type: value
value: "false"
name: GET Request
- description: ""
endpointSecurityType: customer_optional
isSynchronous: true
name: Get Files from Sharepoint
steps:
- action:
key: webhook
component:
isPublic: true
key: webhook-triggers
version: LATEST
description: Example sync flow to return list of files in sharepoint drive
inputs:
body:
type: value
value: ""
contentType:
type: value
value: ""
headers:
type: complex
value: []
statusCode:
type: value
value: ""
isTrigger: true
name: Get Files from Sharepoint Trigger
- action:
key: getFilesFromDrive
component:
isPublic: true
key: ms-sharepoint
version: LATEST
description: ""
inputs:
connection:
type: configVar
value: Microsoft Sharepoint Connection
driveId:
type: configVar
value: Sharepoint Drive
name: List Files in Drive
- description: ""
endpointSecurityType: customer_optional
isSynchronous: false
name: Fetch Events and Documents from Site Lists
steps:
- action:
key: webhook
component:
isPublic: true
key: webhook-triggers
version: LATEST
description: ""
inputs:
body:
type: value
value: ""
contentType:
type: value
value: ""
headers:
type: complex
value: []
statusCode:
type: value
value: ""
isTrigger: true
name: Fetch Events and Documents from Site Lists Trigger
- action:
key: listSiteLists
component:
isPublic: true
key: ms-sharepoint
version: LATEST
description: ""
inputs:
connection:
type: configVar
value: Microsoft Sharepoint Connection
siteId:
type: configVar
value: Select Site
name: List Site Lists
- action:
key: loopOverItems
component:
isPublic: true
key: loop
version: LATEST
description: ""
inputs:
items:
type: reference
value: listSiteLists.results.value
name: Loop Over Site Lists
steps:
- action:
key: getListItemsInSite
component:
isPublic: true
key: ms-sharepoint
version: LATEST
description: ""
inputs:
connection:
type: configVar
value: Microsoft Sharepoint Connection
listId:
type: reference
value: loopOverSiteLists.currentItem.id
optInFields:
type: value
value: ""
pageLimit:
type: value
value: ""
pageToken:
type: value
value: ""
siteId:
type: configVar
value: Select Site
name: List Items in Site List
- action:
key: loopOverItems
component:
isPublic: true
key: loop
version: LATEST
description: ""
inputs:
items:
type: reference
value: listItemsInSiteList.results.value
name: Loop over items in site list
steps:
- action:
key: getItemInSite
component:
isPublic: true
key: ms-sharepoint
version: LATEST
description: ""
inputs:
connection:
type: configVar
value: Microsoft Sharepoint Connection
itemId:
type: reference
value: loopOverItemsInSiteList.currentItem.id
listId:
type: reference
value: loopOverSiteLists.currentItem.id
optInFields:
type: value
value: ""
siteId:
type: configVar
value: Select Site
name: Get Item from Site List
- action:
key: branchOnValue
component:
isPublic: true
key: branch
version: LATEST
branches:
- name: Calendar Event
steps:
- action:
key: writeLog
component:
isPublic: true
key: log
version: LATEST
description: ""
inputs:
level:
type: value
value: info
message:
type: template
value: >-
An event called
"{{$getItemFromSiteList.results.fields.Title}}" is
scheduled to happen on
"{{$getItemFromSiteList.results.fields.EventDate}}"
name: Write event title and date
- name: File
steps:
- action:
key: writeLog
component:
isPublic: true
key: log
version: LATEST
description: ""
inputs:
level:
type: value
value: info
message:
type: template
value: >-
The file
"{{$getItemFromSiteList.results.fields.LinkFilename}}"
is available at web URL
{{$getItemFromSiteList.results.webUrl}}
name: Write document URL
- name: Else
steps: []
description: ""
inputs:
branchValueMappings:
type: complex
value:
- name: Calendar Event
type: value
value: Event
- name: File
type: value
value: Document
inputValue:
type: reference
value: getItemFromSiteList.results.contentType.name
name: Determine Type of Item
name: SharePoint Example
requiredConfigVars:
- connection:
key: oauth
component:
isPublic: true
key: ms-sharepoint
version: LATEST
dataType: connection
inputs:
authorizeUrl:
meta:
visibleToCustomerDeployer: false
visibleToOrgDeployer: false
type: value
value: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize"
clientId:
meta:
visibleToCustomerDeployer: false
visibleToOrgDeployer: false
type: value
value: ""
clientSecret:
meta:
visibleToCustomerDeployer: false
visibleToOrgDeployer: false
type: value
value: ""
scopes:
meta:
visibleToCustomerDeployer: false
visibleToOrgDeployer: false
type: value
value: Sites.ReadWrite.All Sites.Manage.All offline_access
tokenUrl:
meta:
visibleToCustomerDeployer: false
visibleToOrgDeployer: false
type: value
value: "https://login.microsoftonline.com/common/oauth2/v2.0/token"
key: Microsoft Sharepoint Connection
onPremiseConnectionConfig: disallowed
orgOnly: false
- dataSource:
key: listDrives
component:
isPublic: true
key: ms-sharepoint
version: LATEST
dataType: picklist
defaultValue: ""
description: Select a Sharepoint Drive
inputs:
connection:
meta:
orgOnly: true
visibleToCustomerDeployer: false
visibleToOrgDeployer: false
type: configVar
value: Microsoft Sharepoint Connection
dir:
meta:
orgOnly: true
visibleToCustomerDeployer: false
visibleToOrgDeployer: false
type: template
value: /me/drives
key: Sharepoint Drive
orgOnly: false
- dataType: string
defaultValue: "https://postman-echo.com/post"
key: Acme API Endpoint
orgOnly: false
- dataSource:
key: listSites
component:
isPublic: true
key: ms-sharepoint
version: LATEST
dataType: picklist
defaultValue: ""
description: Select a Sharepoint Site
inputs:
connection:
meta:
orgOnly: true
visibleToCustomerDeployer: false
visibleToOrgDeployer: false
type: configVar
value: Microsoft Sharepoint Connection
key: Select Site
orgOnly: false