-
-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
typings enhancements, new examples (get folder author)
- Loading branch information
Showing
18 changed files
with
224 additions
and
168 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
24 changes: 24 additions & 0 deletions
24
examples/sharepoint/lists/assessment/broken_tax_field_value.py
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,24 @@ | ||
""" | ||
Demonstrates how to perform list/library assessment if taxonomy field value association is broken | ||
to term set or not. | ||
To prevent this exception to occur: | ||
'-2146232832, Microsoft.SharePoint.SPFieldValidationException', 'The given guid does not exist in the term store' | ||
""" | ||
from office365.runtime.client_request_exception import ClientRequestException | ||
from office365.sharepoint.client_context import ClientContext | ||
from office365.sharepoint.taxonomy.field import TaxonomyField | ||
from tests import test_client_credentials, test_team_site_url | ||
|
||
ctx = ClientContext(test_team_site_url).with_credentials(test_client_credentials) | ||
lib = ctx.web.default_document_library() | ||
fields = lib.fields.get().execute_query() | ||
for field in fields: | ||
if not isinstance(field, TaxonomyField): | ||
continue | ||
try: | ||
items = lib.items.select([field.internal_name]).top(1).get().execute_query() | ||
print(field.internal_name) | ||
except ClientRequestException: | ||
print(field.is_term_set_valid) | ||
print("Error: {0}".format(field.internal_name)) |
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
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.