-
-
Notifications
You must be signed in to change notification settings - Fork 369
Expand file tree
/
Copy pathget_system_metadata.py
More file actions
54 lines (48 loc) · 1.31 KB
/
Copy pathget_system_metadata.py
File metadata and controls
54 lines (48 loc) · 1.31 KB
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
"""
Retrieves folder system metadata.
See https://learn.microsoft.com/en-us/sharepoint/dev/apis/rest-api/navigation/folder-operations
"""
from office365.sharepoint.client_context import ClientContext
from tests.settings import cert_path, cert_thumbprint, client_id, team_site_url, tenant
ctx = ClientContext(team_site_url).with_client_certificate(
tenant, client_id=client_id, thumbprint=cert_thumbprint, cert_path=cert_path
)
list_title = "Documents"
folder_items = (
ctx.web.lists.get_by_title(list_title)
.items.filter("FSObjType eq 1")
.select(
[
"FSObjType",
"Author/Id",
"Author/Title",
"Author/Name",
"Editor/Id",
"Editor/Title",
"Editor/Name",
]
)
.expand(["Author", "Editor"])
.get()
.execute_query()
)
folder_path = "Archive" # folder relative path
folder_item = (
ctx.web.lists.get_by_title(list_title)
.get_item_by_url(folder_path)
.select(
[
"Author/Id",
"Author/Title",
"Author/Name",
"Editor/Id",
"Editor/Title",
"Editor/Name",
]
)
.expand(["Author", "Editor"])
.get()
.execute_query()
)
print(folder_item.properties.get("Author"))
print(folder_item.properties.get("Editor"))