-
-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples refactorings and type hints enhancements for taxonomy namespace
- Loading branch information
Showing
20 changed files
with
754 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
""" | ||
Creates calculated site field | ||
""" | ||
from office365.sharepoint.client_context import ClientContext | ||
from tests import create_unique_name, test_client_credentials, test_team_site_url | ||
|
||
client = ClientContext(test_team_site_url).with_credentials(test_client_credentials) | ||
field_name = create_unique_name("CalcColumn") | ||
formula = '=CONCATENATE(Author,":",Created)' | ||
field = client.web.fields.add_calculated(field_name, formula).execute_query() | ||
|
||
print("Field {0} has been created".format(field.internal_name)) | ||
field.delete_object().execute_query() # clean up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
""" | ||
Demonstrates how to create a site field of type Taxonomy | ||
""" | ||
|
||
from office365.sharepoint.client_context import ClientContext | ||
from tests import create_unique_name, test_client_credentials, test_team_site_url | ||
|
||
client = ClientContext(test_team_site_url).with_credentials(test_client_credentials) | ||
|
||
# term_sets = client.taxonomy.term_store.get_term_sets_by_name("Sweden").execute_query() | ||
|
||
# field_name = create_unique_name("TaxColumn") | ||
# field = client.web.fields.create_taxonomy_field(field_name).execute_query() | ||
# print("Field {0} has been created".format(field.internal_name)) | ||
# field.delete_object().execute_query() # clean up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
from office365.sharepoint.client_context import ClientContext | ||
from office365.sharepoint.taxonomy.terms.term import Term | ||
from tests import test_client_credentials, test_team_site_url | ||
|
||
term_name = "Sweden" | ||
|
||
ctx = ClientContext(test_team_site_url).with_credentials(test_client_credentials) | ||
terms = ctx.taxonomy.term_store.search_term(term_name).execute_query() | ||
for term in terms: # type: Term | ||
for term in terms: | ||
print(term.labels[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
""" | ||
Reads custom List View items | ||
""" | ||
from office365.sharepoint.client_context import ClientContext | ||
from office365.sharepoint.listitems.listitem import ListItem | ||
from tests import test_client_credentials, test_team_site_url | ||
|
||
ctx = ClientContext(test_team_site_url).with_credentials(test_client_credentials) | ||
view = ctx.web.default_document_library().views.get_by_title("All Documents") | ||
items = view.get_items().expand(["Author"]).execute_query() | ||
for item in items: # type: ListItem | ||
for item in items: | ||
print(item.properties) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.