-
Notifications
You must be signed in to change notification settings - Fork 13
/
get-ModifiedWorkspaces.pq
55 lines (55 loc) · 2.05 KB
/
get-ModifiedWorkspaces.pq
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
let
output =
(generatedToken as text, sinceDateTime as datetime, optional withPersonalWorkspaces as logical) =>
let
excluder = try if not withPersonalWorkspaces then "False" else "True" otherwise "True",
converted =
DateTime.ToText(
sinceDateTime,
"yyyy-MM-ddTHH:mm:ss.0000000Z"
),
apiCall =
Json.Document(
Web.Contents(
"https://api.powerbi.com/v1.0/myorg",
[
RelativePath = "admin/workspaces/modified",
Query = [
modifiedSince = converted,
excludePersonalWorkspaces = excluder
],
Headers = [
#"Content-Type" = "application/json",
Authorization = generatedToken
]
]
)
),
combiner =
#table(
type table [WorkspaceId = text],
List.Transform(
List.Buffer(apiCall),
each
{
_[id]
}
)
)
in
combiner,
documentation = [
Documentation.Name = " get-ModifiedWorkspaces.pq ",
Documentation.Description = " Get Modified Workspaces ",
Documentation.Source = "https://www.jaknapowerbi.cz",
Documentation.Version = " 1.0 ",
Documentation.Author = " Štěpán Rešl "
]
in
Value.ReplaceType(
output,
Value.ReplaceMetadata(
Value.Type(output),
documentation
)
)