Skip to content

Commit 1d4d0f6

Browse files
committed
introduced fontpackage namespace, updates for directory namespace in SharePoint API
1 parent 7243f97 commit 1d4d0f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+632
-49
lines changed

office365/intune/servicecommunications/health/health.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
class ServiceHealth(Entity):
5-
"""Represents the health information of a service subscribed by a tenant."""
5+
"""Represents the sitehealth information of a service subscribed by a tenant."""

office365/intune/servicecommunications/issues/issue.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
class ServiceHealthIssue(ServiceAnnouncementBase):
99
"""
10-
Represents a service health issue in a service.
10+
Represents a service sitehealth issue in a service.
1111
12-
The service health issue can be a service incident or service advisory. For example:
12+
The service sitehealth issue can be a service incident or service advisory. For example:
1313
1414
- Service incident: "Exchange mailbox service is down".
1515
- Service advisory: "Users may experience delays in emails reception".

office365/sharepoint/administration/sitemove/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from typing import TYPE_CHECKING
2+
3+
from office365.runtime.paths.service_operation import ServiceOperationPath
4+
from office365.sharepoint.entity import Entity
5+
6+
if TYPE_CHECKING:
7+
from office365.sharepoint.client_context import ClientContext
8+
9+
10+
class SiteMoveService(Entity):
11+
""" """
12+
13+
def __init__(
14+
self,
15+
context,
16+
site_id,
17+
site_subscription_id=None,
18+
source_database_id=None,
19+
target_database_id=None,
20+
):
21+
# type: (ClientContext, str, str, str, str) -> None
22+
""""""
23+
static_path = ServiceOperationPath(
24+
"Microsoft.SharePoint.Administration.SiteMove.Service.SiteMoveService",
25+
{
26+
"siteId": site_id,
27+
"siteSubscriptionId": site_subscription_id,
28+
"sourceDatabaseId": source_database_id,
29+
"targetDatabaseId": target_database_id,
30+
},
31+
)
32+
super(SiteMoveService, self).__init__(context, static_path)
33+
34+
@property
35+
def entity_type_name(self):
36+
return "Microsoft.SharePoint.Administration.SiteMove.Service.SiteMoveService"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class SiteMoveServiceInfo(ClientValue):
5+
""" """
6+
7+
@property
8+
def entity_type_name(self):
9+
return (
10+
"Microsoft.SharePoint.Administration.SiteMove.Service.SiteMoveServiceInfo"
11+
)

office365/sharepoint/client_context.py

+27-1
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,22 @@ def folder_coloring(self):
498498

499499
return FolderColoring(self, ResourcePath("foldercoloring"))
500500

501+
@property
502+
def font_packages(self):
503+
"""Alias to FontPackageCollection"""
504+
505+
from office365.sharepoint.fontpackages.collection import FontPackageCollection
506+
507+
return FontPackageCollection(self, ResourcePath("fontpackages"))
508+
509+
@property
510+
def site_font_packages(self):
511+
"""Alias to FontPackageCollection"""
512+
513+
from office365.sharepoint.fontpackages.collection import FontPackageCollection
514+
515+
return FontPackageCollection(self, ResourcePath("sitefontpackages"))
516+
501517
@property
502518
def group_site_manager(self):
503519
"""Alias to GroupSiteManager"""
@@ -542,6 +558,16 @@ def profile_loader(self):
542558

543559
return ProfileLoader(self)
544560

561+
@property
562+
def document_crawl_log(self):
563+
"""Alias to DocumentCrawlLog"""
564+
565+
from office365.sharepoint.search.administration.document_crawl_log import (
566+
DocumentCrawlLog,
567+
)
568+
569+
return DocumentCrawlLog(self)
570+
545571
@property
546572
def lists(self):
547573
"""Alias to ListCollection. Gets information about all lists that the current user can access."""
@@ -636,7 +662,7 @@ def home_service(self):
636662
@property
637663
def home_site(self):
638664
"""Alias to SPHSite."""
639-
from office365.sharepoint.sites.sph_site import SPHSite
665+
from office365.sharepoint.sites.home.site import SPHSite
640666

641667
return SPHSite(self, ResourcePath("SPHSite"))
642668

office365/sharepoint/directory/group.py

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66

77
class Group(Entity):
8+
""" """
9+
810
def get_members_info(self, row_limit):
911
""""""
1012
return_type = MembersInfo(self.context)

office365/sharepoint/directory/helper.py

+2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ def get_members_info(context, group_id, row_limit, return_type=None):
8888
@staticmethod
8989
def get_my_groups(context, logon_name, offset, length, return_type=None):
9090
"""
91+
Retrieves information about groups that a user belongs to.
92+
9193
:param office365.sharepoint.client_context.ClientContext context: SharePoint context
9294
:param str logon_name: User's login
9395
:param int offset: Result offset

office365/sharepoint/directory/provider/provider.py

+6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ def __init__(self, context, resource_path=None):
1313
)
1414
super(SharePointDirectoryProvider, self).__init__(context, resource_path)
1515

16+
def check_site_availability(self, site_url):
17+
""""""
18+
from office365.sharepoint.directory.helper import SPHelper
19+
20+
return SPHelper.check_site_availability(self.context, site_url)
21+
1622
def read_directory_object(self, data):
1723
# type: (DirectoryObjectData) -> ClientResult[DirectoryObjectData]
1824
""""""

office365/sharepoint/directory/user.py

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55

66
class User(Entity):
7+
"""Represents a user in the SharePoint Directory"""
8+
79
def is_member_of(self, group_id):
810
return_type = ClientResult(self.context)
911

@@ -18,6 +20,9 @@ def _user_loaded():
1820
return return_type
1921

2022
def get_my_groups(self):
23+
"""
24+
Retrieves information about groups that a user belongs to.
25+
"""
2126
return_type = MyGroupsResult(self.context)
2227

2328
def _user_loaded():
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from typing import Optional
2+
3+
from office365.sharepoint.entity import Entity
4+
5+
6+
class ConnectorResult(Entity):
7+
""" """
8+
9+
@property
10+
def context_data(self):
11+
# type: () -> Optional[str]
12+
return self.properties.get("ContextData", None)
13+
14+
@property
15+
def value(self):
16+
# type: () -> Optional[str]
17+
return self.properties.get("Value", None)

office365/sharepoint/flows/permissions.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
from office365.runtime.client_result import ClientResult
1+
from typing import TYPE_CHECKING, Optional
2+
23
from office365.runtime.queries.service_operation import ServiceOperationQuery
34
from office365.sharepoint.entity import Entity
5+
from office365.sharepoint.flows.connector_result import ConnectorResult
6+
7+
if TYPE_CHECKING:
8+
from office365.sharepoint.client_context import ClientContext
49

510

611
class FlowPermissions(Entity):
712

813
@staticmethod
9-
def get_flow_permission_level_on_list(context, list_name):
10-
"""
11-
:param office365.sharepoint.client_context.ClientContext context: SharePoint client context
12-
:param str list_name: Specifies the list name.
13-
"""
14-
return_type = ClientResult(context)
14+
def get_flow_permission_level_on_list(context, list_name, return_type=None):
15+
# type: (ClientContext, str, Optional[ConnectorResult]) -> ConnectorResult
16+
""" """
17+
if return_type is None:
18+
return_type = ConnectorResult(context)
1519
payload = {"listName": list_name}
1620
qry = ServiceOperationQuery(
1721
FlowPermissions(context),

office365/sharepoint/fontpackages/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from typing import TYPE_CHECKING, Optional
2+
3+
from office365.runtime.paths.resource_path import ResourcePath
4+
from office365.runtime.paths.service_operation import ServiceOperationPath
5+
from office365.sharepoint.entity_collection import EntityCollection
6+
from office365.sharepoint.fontpackages.font_package import FontPackage
7+
8+
if TYPE_CHECKING:
9+
from office365.sharepoint.client_context import ClientContext
10+
11+
12+
class FontPackageCollection(EntityCollection):
13+
"""Represents a collection of View resources."""
14+
15+
def __init__(self, context, resource_path=None):
16+
# type: (ClientContext, Optional[ResourcePath]) -> None
17+
super(FontPackageCollection, self).__init__(context, FontPackage, resource_path)
18+
19+
def get_by_title(self, title):
20+
"""
21+
:param str title: The title of the font package to return.
22+
"""
23+
return FontPackage(
24+
self.context,
25+
ServiceOperationPath("GetByTitle", [title], self.resource_path),
26+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class FontPackageCreationParameters(ClientValue):
5+
""""""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.sharepoint.entity import Entity
2+
3+
4+
class FontPackage(Entity):
5+
"""Represents a font package."""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.sharepoint.entity import Entity
2+
3+
4+
class OutOfBoxFontPackageSettings(Entity):
5+
""""""

office365/sharepoint/lists/list.py

+15
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,21 @@ def _loaded():
177177
self.root_folder.ensure_property("ServerRelativeUrl", _loaded)
178178
return return_type
179179

180+
def get_flow_permission_level(self):
181+
""""""
182+
from office365.sharepoint.flows.connector_result import ConnectorResult
183+
from office365.sharepoint.flows.permissions import FlowPermissions
184+
185+
return_type = ConnectorResult(self.context)
186+
187+
def _loaded():
188+
FlowPermissions.get_flow_permission_level_on_list(
189+
self.context, self.title, return_type
190+
)
191+
192+
self.ensure_property("Title", _loaded)
193+
return return_type
194+
180195
def get_sharing_settings(self):
181196
"""Retrieves a sharing settings for a List"""
182197
return_type = ObjectSharingSettings(self.context)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from office365.sharepoint.entity import Entity
2+
3+
4+
class CardDesigns(Entity):
5+
""""""
6+
7+
@property
8+
def entity_type_name(self):
9+
return "Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.CardDesigns"
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
1+
from typing import AnyStr
2+
3+
from office365.runtime.client_result import ClientResult
4+
from office365.runtime.queries.service_operation import ServiceOperationQuery
15
from office365.sharepoint.entity import Entity
26

37

48
class TeamsPackageDownload(Entity):
59
""""""
610

11+
def download_teams(self):
12+
# type: () -> ClientResult[AnyStr]
13+
""" """
14+
return_type = ClientResult(self.context)
15+
qry = ServiceOperationQuery(
16+
self, "DownloadTeams", None, None, None, return_type
17+
)
18+
self.context.add_query(qry)
19+
return return_type
20+
721
@property
822
def entity_type_name(self):
923
return "Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.TeamsPackageDownload"

office365/sharepoint/marketplace/tenant/appcatalog/accessor.py

+21
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
from office365.sharepoint.marketplace.corporatecuratedgallery.app_upgrade_availability import (
2020
AppUpgradeAvailability,
2121
)
22+
from office365.sharepoint.marketplace.corporatecuratedgallery.card_designs import (
23+
CardDesigns,
24+
)
2225
from office365.sharepoint.marketplace.corporatecuratedgallery.teams_package_download import (
2326
TeamsPackageDownload,
2427
)
@@ -46,6 +49,7 @@ def add(self, content, overwrite, url=None):
4649
return return_type
4750

4851
def app_from_path(self, path, overwrite):
52+
# type: (str, bool) -> File
4953
"""
5054
Adds a file to the corporate catalog.
5155
"""
@@ -66,6 +70,7 @@ def app_requests(self):
6670

6771
def download_teams_solution(self, _id):
6872
"""
73+
Downloads a Microsoft Teams solution package associated with an app from the SharePoint App Catalog
6974
:param int _id:
7075
"""
7176
return_type = TeamsPackageDownload(self.context)
@@ -87,6 +92,7 @@ def get_app_by_id(self, item_unique_id):
8792

8893
def is_app_upgrade_available(self, _id):
8994
"""
95+
Determines if an upgrade is available for an app in the SharePoint app catalog
9096
:param int _id:
9197
"""
9298
return_type = ClientResult(self.context, AppUpgradeAvailability())
@@ -98,6 +104,7 @@ def is_app_upgrade_available(self, _id):
98104
return return_type
99105

100106
def upload(self, content, overwrite, url, xor_hash=None):
107+
""""""
101108
payload = {
102109
"Content": content,
103110
"Overwrite": overwrite,
@@ -110,6 +117,7 @@ def upload(self, content, overwrite, url, xor_hash=None):
110117

111118
def send_app_request_status_notification_email(self, request_guid):
112119
"""
120+
Sends email notifications about the status of an app request in the corporate app catalog
113121
:param str request_guid:
114122
"""
115123
qry = ServiceOperationQuery(
@@ -128,6 +136,14 @@ def available_apps(self):
128136
),
129137
)
130138

139+
@property
140+
def card_designs(self):
141+
"""Returns the card designs available in this corporate catalog."""
142+
return self.properties.get(
143+
"CardDesigns",
144+
CardDesigns(self.context, ResourcePath("CardDesigns", self.resource_path)),
145+
)
146+
131147
@property
132148
def site_collection_app_catalogs_sites(self):
133149
"""Returns an accessor to the allow list of site collections allowed to have site collection corporate
@@ -140,10 +156,15 @@ def site_collection_app_catalogs_sites(self):
140156
),
141157
)
142158

159+
@property
160+
def entity_type_name(self):
161+
return "Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.TenantCorporateCatalogAccessor"
162+
143163
def get_property(self, name, default_value=None):
144164
if default_value is None:
145165
property_mapping = {
146166
"AvailableApps": self.available_apps,
167+
"CardDesigns": self.card_designs,
147168
"SiteCollectionAppCatalogsSites": self.site_collection_app_catalogs_sites,
148169
}
149170
default_value = property_mapping.get(name, None)

0 commit comments

Comments
 (0)