Skip to content

Commit

Permalink
examples updates, remove sensitive data (cert)
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrem committed Oct 14, 2023
1 parent 9957489 commit 52fa715
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 55 deletions.
21 changes: 0 additions & 21 deletions examples/selfsigncert.pem

This file was deleted.

28 changes: 0 additions & 28 deletions examples/selfsignkey.pem

This file was deleted.

21 changes: 21 additions & 0 deletions examples/sharepoint/tenant/get_site_admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""
Gets site collection administrators
"""

from office365.sharepoint.sites.site import Site
from office365.sharepoint.tenant.administration.tenant import Tenant
from tests import test_admin_site_url, test_site_url, test_user_credentials

tenant = Tenant.from_url(test_admin_site_url).with_credentials(test_user_credentials)

target_site = (
Site.from_url(test_site_url)
.with_credentials(test_user_credentials)
.get()
.execute_query()
)
result = tenant.get_site_secondary_administrators(
site_id=target_site.id
).execute_query()
for admin in result.value:
print(admin.loginName)
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
from office365.sharepoint.sites.site import Site
from office365.sharepoint.tenant.administration.secondary_administrators_info import (
SecondaryAdministratorsInfo,
)
from office365.sharepoint.tenant.administration.tenant import Tenant
from tests import (
test_admin_site_url,
Expand All @@ -18,8 +15,9 @@
.get()
.execute_query()
)
admins = tenant.get_site_secondary_administrators(site_id=target_site.id)
tenant.execute_query()
admins = tenant.get_site_secondary_administrators(
site_id=target_site.id
).execute_query()

existing_admin_names = [admin.loginName for admin in admins]

Expand All @@ -31,5 +29,5 @@
site_id=target_site.id, names=names
).execute_query()

for admin in admins: # type: SecondaryAdministratorsInfo
for admin in admins:
print(admin.loginName)

0 comments on commit 52fa715

Please sign in to comment.