-
-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SharePoint API: get_user_effective_permissions method fix and example (…
…#407) File and Folder properties
- Loading branch information
Showing
12 changed files
with
246 additions
and
44 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,19 @@ | ||
from pprint import pprint | ||
|
||
from office365.sharepoint.client_context import ClientContext | ||
from office365.sharepoint.permissions.permission_kind import PermissionKind | ||
from tests import test_team_site_url, test_user_principal_name_alt, test_user_credentials | ||
|
||
client = ClientContext(test_team_site_url).with_credentials(test_user_credentials) | ||
file_url = "/sites/team/Shared Documents/report #123.csv" | ||
|
||
# user = client.web.site_users.get_by_email(test_user_principal_name_alt).get().execute_query() | ||
target_user = client.web.site_users.get_by_email(test_user_principal_name_alt) | ||
target_file = client.web.get_file_by_server_relative_path(file_url) | ||
result = target_file.listItemAllFields.get_user_effective_permissions(target_user).execute_query() | ||
pprint(result.value.permission_levels) # print all permission levels | ||
|
||
# verify whether user has Reader role to a file | ||
if result.value.has(PermissionKind.OpenItems): | ||
print("User has access to read a file") | ||
|
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from office365.sharepoint.base_entity import BaseEntity | ||
|
||
|
||
class FileVersionEvent(BaseEntity): | ||
"""""" | ||
pass |
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
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.