Skip to content

Commit

Permalink
introduced fontpackage namespace, updates for directory namespace in …
Browse files Browse the repository at this point in the history
…SharePoint API
  • Loading branch information
vgrem committed Jan 6, 2025
1 parent 7243f97 commit 1d4d0f6
Show file tree
Hide file tree
Showing 55 changed files with 632 additions and 49 deletions.
2 changes: 1 addition & 1 deletion office365/intune/servicecommunications/health/health.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class ServiceHealth(Entity):
"""Represents the health information of a service subscribed by a tenant."""
"""Represents the sitehealth information of a service subscribed by a tenant."""
4 changes: 2 additions & 2 deletions office365/intune/servicecommunications/issues/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

class ServiceHealthIssue(ServiceAnnouncementBase):
"""
Represents a service health issue in a service.
Represents a service sitehealth issue in a service.
The service health issue can be a service incident or service advisory. For example:
The service sitehealth issue can be a service incident or service advisory. For example:
- Service incident: "Exchange mailbox service is down".
- Service advisory: "Users may experience delays in emails reception".
Expand Down
Empty file.
36 changes: 36 additions & 0 deletions office365/sharepoint/administration/sitemove/service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from typing import TYPE_CHECKING

from office365.runtime.paths.service_operation import ServiceOperationPath
from office365.sharepoint.entity import Entity

if TYPE_CHECKING:
from office365.sharepoint.client_context import ClientContext


class SiteMoveService(Entity):
""" """

def __init__(
self,
context,
site_id,
site_subscription_id=None,
source_database_id=None,
target_database_id=None,
):
# type: (ClientContext, str, str, str, str) -> None
""""""
static_path = ServiceOperationPath(
"Microsoft.SharePoint.Administration.SiteMove.Service.SiteMoveService",
{
"siteId": site_id,
"siteSubscriptionId": site_subscription_id,
"sourceDatabaseId": source_database_id,
"targetDatabaseId": target_database_id,
},
)
super(SiteMoveService, self).__init__(context, static_path)

@property
def entity_type_name(self):
return "Microsoft.SharePoint.Administration.SiteMove.Service.SiteMoveService"
11 changes: 11 additions & 0 deletions office365/sharepoint/administration/sitemove/service_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from office365.runtime.client_value import ClientValue


class SiteMoveServiceInfo(ClientValue):
""" """

@property
def entity_type_name(self):
return (
"Microsoft.SharePoint.Administration.SiteMove.Service.SiteMoveServiceInfo"
)
28 changes: 27 additions & 1 deletion office365/sharepoint/client_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,22 @@ def folder_coloring(self):

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

@property
def font_packages(self):
"""Alias to FontPackageCollection"""

from office365.sharepoint.fontpackages.collection import FontPackageCollection

return FontPackageCollection(self, ResourcePath("fontpackages"))

@property
def site_font_packages(self):
"""Alias to FontPackageCollection"""

from office365.sharepoint.fontpackages.collection import FontPackageCollection

return FontPackageCollection(self, ResourcePath("sitefontpackages"))

@property
def group_site_manager(self):
"""Alias to GroupSiteManager"""
Expand Down Expand Up @@ -542,6 +558,16 @@ def profile_loader(self):

return ProfileLoader(self)

@property
def document_crawl_log(self):
"""Alias to DocumentCrawlLog"""

from office365.sharepoint.search.administration.document_crawl_log import (
DocumentCrawlLog,
)

return DocumentCrawlLog(self)

@property
def lists(self):
"""Alias to ListCollection. Gets information about all lists that the current user can access."""
Expand Down Expand Up @@ -636,7 +662,7 @@ def home_service(self):
@property
def home_site(self):
"""Alias to SPHSite."""
from office365.sharepoint.sites.sph_site import SPHSite
from office365.sharepoint.sites.home.site import SPHSite

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

Expand Down
2 changes: 2 additions & 0 deletions office365/sharepoint/directory/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@


class Group(Entity):
""" """

def get_members_info(self, row_limit):
""""""
return_type = MembersInfo(self.context)
Expand Down
2 changes: 2 additions & 0 deletions office365/sharepoint/directory/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ def get_members_info(context, group_id, row_limit, return_type=None):
@staticmethod
def get_my_groups(context, logon_name, offset, length, return_type=None):
"""
Retrieves information about groups that a user belongs to.
:param office365.sharepoint.client_context.ClientContext context: SharePoint context
:param str logon_name: User's login
:param int offset: Result offset
Expand Down
6 changes: 6 additions & 0 deletions office365/sharepoint/directory/provider/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ def __init__(self, context, resource_path=None):
)
super(SharePointDirectoryProvider, self).__init__(context, resource_path)

def check_site_availability(self, site_url):
""""""
from office365.sharepoint.directory.helper import SPHelper

return SPHelper.check_site_availability(self.context, site_url)

def read_directory_object(self, data):
# type: (DirectoryObjectData) -> ClientResult[DirectoryObjectData]
""""""
Expand Down
5 changes: 5 additions & 0 deletions office365/sharepoint/directory/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@


class User(Entity):
"""Represents a user in the SharePoint Directory"""

def is_member_of(self, group_id):
return_type = ClientResult(self.context)

Expand All @@ -18,6 +20,9 @@ def _user_loaded():
return return_type

def get_my_groups(self):
"""
Retrieves information about groups that a user belongs to.
"""
return_type = MyGroupsResult(self.context)

def _user_loaded():
Expand Down
17 changes: 17 additions & 0 deletions office365/sharepoint/flows/connector_result.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from typing import Optional

from office365.sharepoint.entity import Entity


class ConnectorResult(Entity):
""" """

@property
def context_data(self):
# type: () -> Optional[str]
return self.properties.get("ContextData", None)

@property
def value(self):
# type: () -> Optional[str]
return self.properties.get("Value", None)
18 changes: 11 additions & 7 deletions office365/sharepoint/flows/permissions.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
from office365.runtime.client_result import ClientResult
from typing import TYPE_CHECKING, Optional

from office365.runtime.queries.service_operation import ServiceOperationQuery
from office365.sharepoint.entity import Entity
from office365.sharepoint.flows.connector_result import ConnectorResult

if TYPE_CHECKING:
from office365.sharepoint.client_context import ClientContext


class FlowPermissions(Entity):

@staticmethod
def get_flow_permission_level_on_list(context, list_name):
"""
:param office365.sharepoint.client_context.ClientContext context: SharePoint client context
:param str list_name: Specifies the list name.
"""
return_type = ClientResult(context)
def get_flow_permission_level_on_list(context, list_name, return_type=None):
# type: (ClientContext, str, Optional[ConnectorResult]) -> ConnectorResult
""" """
if return_type is None:
return_type = ConnectorResult(context)
payload = {"listName": list_name}
qry = ServiceOperationQuery(
FlowPermissions(context),
Expand Down
Empty file.
26 changes: 26 additions & 0 deletions office365/sharepoint/fontpackages/collection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from typing import TYPE_CHECKING, Optional

from office365.runtime.paths.resource_path import ResourcePath
from office365.runtime.paths.service_operation import ServiceOperationPath
from office365.sharepoint.entity_collection import EntityCollection
from office365.sharepoint.fontpackages.font_package import FontPackage

if TYPE_CHECKING:
from office365.sharepoint.client_context import ClientContext


class FontPackageCollection(EntityCollection):
"""Represents a collection of View resources."""

def __init__(self, context, resource_path=None):
# type: (ClientContext, Optional[ResourcePath]) -> None
super(FontPackageCollection, self).__init__(context, FontPackage, resource_path)

def get_by_title(self, title):
"""
:param str title: The title of the font package to return.
"""
return FontPackage(
self.context,
ServiceOperationPath("GetByTitle", [title], self.resource_path),
)
5 changes: 5 additions & 0 deletions office365/sharepoint/fontpackages/creation_parameters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from office365.runtime.client_value import ClientValue


class FontPackageCreationParameters(ClientValue):
""""""
5 changes: 5 additions & 0 deletions office365/sharepoint/fontpackages/font_package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from office365.sharepoint.entity import Entity


class FontPackage(Entity):
"""Represents a font package."""
5 changes: 5 additions & 0 deletions office365/sharepoint/fontpackages/oob_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from office365.sharepoint.entity import Entity


class OutOfBoxFontPackageSettings(Entity):
""""""
15 changes: 15 additions & 0 deletions office365/sharepoint/lists/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,21 @@ def _loaded():
self.root_folder.ensure_property("ServerRelativeUrl", _loaded)
return return_type

def get_flow_permission_level(self):
""""""
from office365.sharepoint.flows.connector_result import ConnectorResult
from office365.sharepoint.flows.permissions import FlowPermissions

return_type = ConnectorResult(self.context)

def _loaded():
FlowPermissions.get_flow_permission_level_on_list(
self.context, self.title, return_type
)

self.ensure_property("Title", _loaded)
return return_type

def get_sharing_settings(self):
"""Retrieves a sharing settings for a List"""
return_type = ObjectSharingSettings(self.context)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from office365.sharepoint.entity import Entity


class CardDesigns(Entity):
""""""

@property
def entity_type_name(self):
return "Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.CardDesigns"
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
from typing import AnyStr

from office365.runtime.client_result import ClientResult
from office365.runtime.queries.service_operation import ServiceOperationQuery
from office365.sharepoint.entity import Entity


class TeamsPackageDownload(Entity):
""""""

def download_teams(self):
# type: () -> ClientResult[AnyStr]
""" """
return_type = ClientResult(self.context)
qry = ServiceOperationQuery(
self, "DownloadTeams", None, None, None, return_type
)
self.context.add_query(qry)
return return_type

@property
def entity_type_name(self):
return "Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.TeamsPackageDownload"
21 changes: 21 additions & 0 deletions office365/sharepoint/marketplace/tenant/appcatalog/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
from office365.sharepoint.marketplace.corporatecuratedgallery.app_upgrade_availability import (
AppUpgradeAvailability,
)
from office365.sharepoint.marketplace.corporatecuratedgallery.card_designs import (
CardDesigns,
)
from office365.sharepoint.marketplace.corporatecuratedgallery.teams_package_download import (
TeamsPackageDownload,
)
Expand Down Expand Up @@ -46,6 +49,7 @@ def add(self, content, overwrite, url=None):
return return_type

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

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

def is_app_upgrade_available(self, _id):
"""
Determines if an upgrade is available for an app in the SharePoint app catalog
:param int _id:
"""
return_type = ClientResult(self.context, AppUpgradeAvailability())
Expand All @@ -98,6 +104,7 @@ def is_app_upgrade_available(self, _id):
return return_type

def upload(self, content, overwrite, url, xor_hash=None):
""""""
payload = {
"Content": content,
"Overwrite": overwrite,
Expand All @@ -110,6 +117,7 @@ def upload(self, content, overwrite, url, xor_hash=None):

def send_app_request_status_notification_email(self, request_guid):
"""
Sends email notifications about the status of an app request in the corporate app catalog
:param str request_guid:
"""
qry = ServiceOperationQuery(
Expand All @@ -128,6 +136,14 @@ def available_apps(self):
),
)

@property
def card_designs(self):
"""Returns the card designs available in this corporate catalog."""
return self.properties.get(
"CardDesigns",
CardDesigns(self.context, ResourcePath("CardDesigns", self.resource_path)),
)

@property
def site_collection_app_catalogs_sites(self):
"""Returns an accessor to the allow list of site collections allowed to have site collection corporate
Expand All @@ -140,10 +156,15 @@ def site_collection_app_catalogs_sites(self):
),
)

@property
def entity_type_name(self):
return "Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.TenantCorporateCatalogAccessor"

def get_property(self, name, default_value=None):
if default_value is None:
property_mapping = {
"AvailableApps": self.available_apps,
"CardDesigns": self.card_designs,
"SiteCollectionAppCatalogsSites": self.site_collection_app_catalogs_sites,
}
default_value = property_mapping.get(name, None)
Expand Down
Loading

0 comments on commit 1d4d0f6

Please sign in to comment.