Skip to content

Commit b5e22b5

Browse files
committed
SharePoint API: homesites, apps and tenant namespaces enhancements
1 parent 85117e6 commit b5e22b5

File tree

15 files changed

+105
-13
lines changed

15 files changed

+105
-13
lines changed

office365/sharepoint/appprincipal/identity_provider.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@
33

44
class AppPrincipalIdentityProvider(BaseEntity):
55
"""Represents an identity provider for app principals."""
6-
pass
6+
7+
@staticmethod
8+
def external(context):
9+
pass
10+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.sharepoint.base_entity import BaseEntity
2+
3+
4+
class SPAppLicenseManager(BaseEntity):
5+
pass
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.sharepoint.base_entity import BaseEntity
2+
3+
4+
class SolutionExporter(BaseEntity):
5+
pass
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.sharepoint.base_entity import BaseEntity
2+
3+
4+
class UserSolution(BaseEntity):
5+
pass
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
1+
from office365.runtime.client_result import ClientResult
2+
from office365.runtime.queries.service_operation import ServiceOperationQuery
3+
from office365.runtime.types.collections import StringCollection
14
from office365.sharepoint.base_entity import BaseEntity
25

36

47
class AppBdcCatalog(BaseEntity):
5-
pass
8+
"""
9+
Represents the Business Data Connectivity (BDC) MetadataCatalog for an application that contains external content
10+
types provisioned by the application.
11+
"""
12+
13+
def get_permissible_connections(self):
14+
"""
15+
Gets the list of external connections that the application has permissions to use.
16+
"""
17+
return_type = ClientResult(self.context, StringCollection())
18+
qry = ServiceOperationQuery(self, "GetPermissibleConnections", None, None, None, return_type)
19+
self.context.add_query(qry)
20+
return return_type
21+
22+
@property
23+
def entity_type_name(self):
24+
return "SP.BusinessData.AppBdcCatalog"

office365/sharepoint/client_context.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,12 @@ def ee(self):
338338
from office365.sharepoint.viva.employee_engagement import EmployeeEngagement
339339
return EmployeeEngagement(self)
340340

341+
@property
342+
def employee_experience(self):
343+
"""Alias to EmployeeExperience"""
344+
from office365.sharepoint.viva.employee_experience_controller import EmployeeExperienceController
345+
return EmployeeExperienceController(self)
346+
341347
@property
342348
def micro_service_manager(self):
343349
"""Alias to MicroServiceManager"""
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from office365.sharepoint.base_entity import BaseEntity
2+
3+
4+
class ComponentContextInfo(BaseEntity):
5+
"""This class functions as a wrapper of the ContextInfo object. Reserved for internal use only."""
6+
7+
@property
8+
def entity_type_name(self):
9+
return "Microsoft.SharePoint.Internal.ClientSideComponent.ComponentContextInfo"

office365/sharepoint/fileservices/__init__.py

Whitespace-only changes.

office365/sharepoint/largeoperation/__init__.py

Whitespace-only changes.

office365/sharepoint/tenant/administration/internal/web_appservice_principal.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from office365.runtime.paths.resource_path import ResourcePath
2+
from office365.runtime.queries.service_operation import ServiceOperationQuery
23
from office365.sharepoint.base_entity import BaseEntity
34

45

@@ -8,6 +9,15 @@ def __init__(self, context):
89
stat_path = ResourcePath("Microsoft.Online.SharePoint.TenantAdministration.Internal.SPOWebAppServicePrincipal")
910
super(SPOWebAppServicePrincipal, self).__init__(context, stat_path)
1011

12+
13+
def update_spfx_client_secret(self, secret_value):
14+
"""
15+
:param str secret_value:
16+
"""
17+
payload = {"secretValue": secret_value}
18+
qry = ServiceOperationQuery(self, "UpdateSpfxClientSecret", None, payload)
19+
self.context.add_query(qry)
20+
1121
@property
1222
def entity_type_name(self):
1323
return "Microsoft.Online.SharePoint.TenantAdministration.Internal.SPOWebAppServicePrincipal"

office365/sharepoint/tenant/administration/tenant.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,17 @@ def get_home_sites_details(self):
114114
self.context.add_query(qry)
115115
return return_type
116116

117-
def remove_home_site(self):
117+
def remove_home_site(self, home_site_url):
118118
"""
119+
Remove home site
120+
121+
:param str home_site_url:
119122
"""
120-
return_type = ClientResult(self.context, str())
121-
qry = ServiceOperationQuery(self, "RemoveSPHSite", None, None, None, return_type)
123+
payload = {"homeSiteUrl": home_site_url}
124+
qry = ServiceOperationQuery(self, "RemoveHomeSite", None, payload)
122125
self.context.add_query(qry)
123-
return return_type
126+
return self
127+
124128

125129
def has_valid_education_license(self):
126130
""""""
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.sharepoint.base_entity import BaseEntity
2+
3+
4+
class TenantAppUtility(BaseEntity):
5+
pass
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.sharepoint.base_entity import BaseEntity
2+
3+
4+
class EmployeeExperienceController(BaseEntity):
5+
pass

tests/sharepoint/test_bdc.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from unittest import TestCase
2+
3+
from office365.sharepoint.client_context import ClientContext
4+
from tests import test_admin_site_url, test_admin_credentials
5+
6+
7+
class TestBdc(TestCase):
8+
9+
def test_1_get_corporate_catalog_url(self):
10+
client = ClientContext(test_admin_site_url).with_credentials(test_admin_credentials)
11+
return_type = client.tenant_settings.get().execute_query()
12+
self.assertIsNotNone(return_type.corporate_catalog_url)
13+
14+

tests/sharepoint/test_tenant.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
1-
from random import randint
21
from unittest import TestCase
32

43
from office365.runtime.client_value_collection import ClientValueCollection
54
from office365.sharepoint.client_context import ClientContext
65
from office365.sharepoint.publishing.portal_health_status import PortalHealthStatus
76
from office365.sharepoint.tenant.administration.settings_service import TenantAdminSettingsService
87
from office365.sharepoint.tenant.administration.sharing_capabilities import SharingCapabilities
9-
from office365.sharepoint.tenant.cdn_api import TenantCdnApi
10-
from office365.sharepoint.tenant.management.office365_tenant import Office365Tenant
118
from office365.sharepoint.tenant.administration.site_properties import SiteProperties
129
from office365.sharepoint.tenant.administration.site_properties_collection import SitePropertiesCollection
1310
from office365.sharepoint.tenant.administration.tenant import Tenant
11+
from office365.sharepoint.tenant.cdn_api import TenantCdnApi
12+
from office365.sharepoint.tenant.management.office365_tenant import Office365Tenant
1413
from office365.sharepoint.tenant.settings import TenantSettings
15-
from tests import test_site_url, test_admin_site_url, test_user_credentials, test_team_site_url
14+
from tests import test_site_url, test_admin_site_url, test_team_site_url, test_admin_credentials
1615

1716

1817
class TestTenant(TestCase):
1918
target_site_props = None # type: SiteProperties
20-
target_site_url = "{base_url}sites/{site_name}".format(base_url=test_site_url,
21-
site_name="Site_" + str(randint(0, 10000)))
2219

2320
@classmethod
2421
def setUpClass(cls):
25-
client = ClientContext(test_admin_site_url).with_credentials(test_user_credentials)
22+
client = ClientContext(test_admin_site_url).with_credentials(test_admin_credentials)
2623
cls.tenant = Tenant(client)
2724
cls.client = client
2825

@@ -140,3 +137,7 @@ def test_20_get_tenant_cdn_api(self):
140137
#def test_21_get_onedrive_site_sharing_insights(self):
141138
# result = self.tenant.get_onedrive_site_sharing_insights(1).execute_query()
142139
# self.assertIsNotNone(result.value)
140+
141+
def test_22_get_home_site_url(self):
142+
result = self.tenant.get_home_site_url().execute_query()
143+
self.assertIsNotNone(result.value)

0 commit comments

Comments
 (0)