-
-
Notifications
You must be signed in to change notification settings - Fork 369
Expand file tree
/
Copy pathchange_sharing_capability.py
More file actions
22 lines (17 loc) · 761 Bytes
/
Copy pathchange_sharing_capability.py
File metadata and controls
22 lines (17 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""
Set external sharing on site collections in Office 365
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/set-external-sharing-on-site-collections-in-office-365
"""
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.tenant.administration.sharing_capabilities import (
SharingCapabilities,
)
from tests import (
test_admin_site_url,
test_client_credentials,
test_team_site_url,
)
admin_client = ClientContext(test_admin_site_url).with_credentials(test_client_credentials)
site_props = admin_client.tenant.get_site_properties_by_url(test_team_site_url).execute_query()
site_props.sharing_capability = SharingCapabilities.ExternalUserAndGuestSharing
site_props.update().execute_query()