-
-
Notifications
You must be signed in to change notification settings - Fork 371
Expand file tree
/
Copy pathget_field_value.py
More file actions
19 lines (15 loc) · 646 Bytes
/
get_field_value.py
File metadata and controls
19 lines (15 loc) · 646 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""
Demonstrates how to get taxonomy field value
"""
import sys
from office365.sharepoint.client_context import ClientContext
from tests import test_client_credentials, test_team_site_url
ctx = ClientContext(test_team_site_url).with_credentials(test_client_credentials)
custom_list = ctx.web.lists.get_by_title("Requests")
list_items = custom_list.items.get().execute_query()
if len(list_items) == 0:
sys.exit("No list items were found.")
tax_field_value = list_items[0].get_property("Country")
tax_field_multi_value = list_items[0].get_property("Countries")
print(tax_field_value["TermGuid"])
print(tax_field_multi_value[0]["TermGuid"])