Skip to content

Commit 09ecb30

Browse files
committed
publishing & viva namespaces new types and methods
1 parent c413586 commit 09ecb30

Some content is hidden

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

42 files changed

+531
-24
lines changed

examples/sharepoint/users/search_tenant_users.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
ctx = ClientContext(test_team_site_url).with_credentials(test_client_credentials)
1414
result = ClientPeoplePickerWebServiceInterface.client_people_picker_search_user(
15-
ctx, "Joe"
15+
ctx, "Jon"
1616
).execute_query()
1717
entries = json.loads(result.value)
1818
for entry in entries:

generator/import_metadata.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ def export_to_file(path, content):
2626
"--endpoint",
2727
dest="endpoint",
2828
help="Import metadata endpoint",
29-
default="sharepoint",
29+
default="graph",
3030
)
3131
parser.add_argument(
3232
"-p",
3333
"--path",
3434
dest="path",
35-
default="./metadata/SharePoint.xml",
35+
default="./metadata/Graph.xml",
3636
help="Import metadata endpoint",
3737
)
3838

office365/admin/people_settings.py

+16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
from office365.entity import Entity
2+
from office365.entity_collection import EntityCollection
3+
from office365.outlook.people.profile_card_property import ProfileCardProperty
4+
from office365.runtime.paths.resource_path import ResourcePath
25

36

47
class PeopleAdminSettings(Entity):
58
"""Represents a setting to control people-related admin settings in the tenant."""
9+
10+
@property
11+
def profile_card_properties(self):
12+
"""Contains a collection of the properties an administrator has defined as visible on the
13+
Microsoft 365 profile card."""
14+
return self.properties.get(
15+
"profileCardProperties",
16+
EntityCollection(
17+
self.context,
18+
ProfileCardProperty,
19+
ResourcePath("profileCardProperties", self.resource_path),
20+
),
21+
)

office365/directory/identitygovernance/privilegedaccess/group.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from office365.directory.identitygovernance.privilegedaccess.approval import Approval
2-
from office365.directory.identitygovernance.privilegedaccess.group_assignment_schedule_instance import (
2+
from office365.directory.identitygovernance.privilegedaccess.schedule.group_assignment_instance import (
33
PrivilegedAccessGroupAssignmentScheduleInstance,
44
)
55
from office365.entity import Entity

office365/directory/identitygovernance/privilegedaccess/schedule/__init__.py

Whitespace-only changes.

office365/directory/identitygovernance/privilegedaccess/group_assignment_schedule_instance.py renamed to office365/directory/identitygovernance/privilegedaccess/schedule/group_assignment_instance.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from office365.directory.identitygovernance.privilegedaccess.schedule_instance import (
1+
from office365.directory.identitygovernance.privilegedaccess.schedule.instance import (
22
PrivilegedAccessScheduleInstance,
33
)
44

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from office365.entity import Entity
2+
3+
4+
class PrivilegedAccessSchedule(Entity):
5+
"""An abstract type that exposes properties relating to the schedule of assigned and eligible membership and
6+
ownership to groups that are governed by PIM."""

office365/outlook/people/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from office365.entity import Entity
2+
3+
4+
class ProfileCardProperty(Entity):
5+
"""
6+
Represents an attribute of a user on the Microsoft 365 profile card for an organization to surface in a shared,
7+
people experience.
8+
9+
The attribute can be an Microsoft Entra ID built-in attribute, such as Alias or UserPrincipalName,
10+
or it can be a custom attribute. For a custom attribute, an administrator can define an en-us default display name
11+
String and a set of alternative translations for the languages supported in their organization.
12+
13+
For more information about how to add properties to the profile card for an organization, see Add or remove
14+
custom attributes on a profile card using the profile card API.
15+
"""

office365/reports/root.py

+13
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,19 @@ def get_email_app_usage_user_counts(self, period):
119119
self.context.add_query(qry)
120120
return qry.return_type
121121

122+
###
123+
def get_email_app_usage_user_detail(self, period):
124+
"""
125+
Get details about which activities users performed on the various email apps.
126+
127+
:param str period: Specifies the length of time over which the report is aggregated.
128+
The supported values for {period_value} are: D7, D30, D90, and D180. These values follow the format
129+
Dn where n represents the number of days over which the report is aggregated. Required.
130+
"""
131+
qry = create_report_query(self, "getEmailAppUsageUserDetail", period, True)
132+
self.context.add_query(qry)
133+
return qry.return_type
134+
122135
def get_mailbox_usage_storage(self, period):
123136
"""
124137
Get the amount of storage used in your organization.

office365/sharepoint/apps/launcher.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from office365.sharepoint.entity import Entity
2+
3+
4+
class AppLauncher(Entity):
5+
""""""
6+
7+
@property
8+
def entity_type_name(self):
9+
return "Microsoft.Online.SharePoint.AppLauncher.AppLauncher"

office365/sharepoint/brandcenter/brand_center.py

+24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
from office365.runtime.client_result import ClientResult
2+
from office365.runtime.paths.resource_path import ResourcePath
3+
from office365.runtime.queries.service_operation import ServiceOperationQuery
4+
from office365.sharepoint.brandcenter.configuration import BrandCenterConfiguration
15
from office365.sharepoint.entity import Entity
6+
from office365.sharepoint.sites.themes import SiteThemes
27

38

49
class BrandCenter(Entity):
@@ -7,3 +12,22 @@ class BrandCenter(Entity):
712
that empowers your brand managers or designated brand owners to help your organization to customize
813
the look and feel of their experiences.
914
"""
15+
16+
def __init__(self, context):
17+
super(BrandCenter, self).__init__(context, ResourcePath("SP.BrandCenter"))
18+
19+
def configuration(self):
20+
return_type = ClientResult(self.context, BrandCenterConfiguration())
21+
qry = ServiceOperationQuery(
22+
self, "Configuration", None, None, None, return_type
23+
)
24+
self.context.add_query(qry)
25+
return return_type
26+
27+
def get_site_themes(self):
28+
return_type = ClientResult(self.context, SiteThemes())
29+
qry = ServiceOperationQuery(
30+
self, "GetSiteThemes", None, None, None, return_type
31+
)
32+
self.context.add_query(qry)
33+
return return_type

office365/sharepoint/client_context.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ def brand_center(self):
405405

406406
from office365.sharepoint.brandcenter.brand_center import BrandCenter
407407

408-
return BrandCenter(self, ResourcePath("BrandCenter"))
408+
return BrandCenter(self)
409409

410410
@property
411411
def client_people_picker(self):
@@ -631,6 +631,14 @@ def site_manager(self):
631631

632632
return SPSiteManager(self, ResourcePath("spSiteManager"))
633633

634+
@property
635+
def site_manager_svc(self):
636+
"""Alias to SiteManagerService."""
637+
638+
from office365.sharepoint.sites.manager.service import SiteManagerService
639+
640+
return SiteManagerService(self)
641+
634642
@property
635643
def social_feed_manager(self):
636644
"""Alias to SocialFeedManager."""

office365/sharepoint/listitems/listitem.py

+7
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ def __init__(self, context, resource_path=None, parent_list=None):
5959
if parent_list is not None:
6060
self.set_property("ParentList", parent_list, False)
6161

62+
def archive(self):
63+
"""Archives the list item."""
64+
return_type = ClientResult(self.context, str())
65+
qry = ServiceOperationQuery(self, "Archive", None, None, None, return_type)
66+
self.context.add_query(qry)
67+
return return_type
68+
6269
def share_link(self, link_kind, expiration=None, role=None, password=None):
6370
# type: (int, Optional[datetime.datetime], Optional[int], Optional[str]) -> ClientResult[ShareLinkResponse]
6471
"""Creates a tokenized sharing link for a list item based on the specified parameters and optionally
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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 MigrationUrlParser(Entity):
11+
""""""
12+
13+
def __init__(
14+
self,
15+
context,
16+
user_input_destination_url,
17+
retrive_all_lists,
18+
retrieve_all_lists_sub_folders,
19+
force_my_site_default_list,
20+
migration_type,
21+
current_context_site_subscription_id,
22+
):
23+
# type: (ClientContext, str, bool, bool, bool, str, str) -> None
24+
static_path = ServiceOperationPath(
25+
"SP.AppContextSite",
26+
{
27+
"userInputDestinationUrl": user_input_destination_url,
28+
"retriveAllLists": retrive_all_lists,
29+
"retrieveAllListsSubFolders": retrieve_all_lists_sub_folders,
30+
"forceMySiteDefaultList": force_my_site_default_list,
31+
"migrationType": migration_type,
32+
"currentContextSiteSubscriptionId": current_context_site_subscription_id,
33+
},
34+
)
35+
super(MigrationUrlParser, self).__init__(context, static_path)
36+
37+
@property
38+
def entity_type_name(self):
39+
return "Microsoft.Online.SharePoint.MigrationCenter.Common.MigrationUrlParser"

office365/sharepoint/publishing/pages/campaign/__init__.py

Whitespace-only changes.

office365/sharepoint/publishing/pages/campaign_publication.py renamed to office365/sharepoint/publishing/pages/campaign/publication.py

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

88

99
class CampaignPublication(SitePage):
10+
""" """
11+
1012
def get_highlights_info(self):
1113
""" """
1214
return_type = HighlightsInfo(self.context)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from office365.runtime.client_value import ClientValue
2+
from office365.sharepoint.publishing.pages.fields_data import SitePageFieldsData
3+
4+
5+
class CampaignPublicationMailDraftData(ClientValue):
6+
""" """
7+
8+
@property
9+
def entity_type_name(self):
10+
return "SP.Publishing.CampaignPublicationMailDraftData"
11+
12+
13+
class CampaignPublicationFieldsData(SitePageFieldsData):
14+
""" """
15+
16+
@property
17+
def entity_type_name(self):
18+
return "SP.Publishing.CampaignPublicationFieldsData"

office365/sharepoint/publishing/pages/coauth_state.py

+20
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,26 @@
33

44
class SitePageCoAuthState(ClientValue):
55

6+
def __init__(
7+
self,
8+
action=None,
9+
has_reached_minor_versions_limit=None,
10+
is_new_session=None,
11+
is_partition_flushed=None,
12+
lock_action=None,
13+
lock_duration=None,
14+
overwrite_existing_version=None,
15+
shared_lock_id=None,
16+
):
17+
self.Action = action
18+
self.HasReachedMinorVersionsLimit = has_reached_minor_versions_limit
19+
self.IsNewSession = is_new_session
20+
self.IsPartitionFlushed = is_partition_flushed
21+
self.LockAction = lock_action
22+
self.LockDuration = lock_duration
23+
self.OverwriteExistingVersion = overwrite_existing_version
24+
self.SharedLockId = shared_lock_id
25+
626
@property
727
def entity_type_name(self):
828
return "SP.Publishing.SitePageCoAuthState"

office365/sharepoint/publishing/pages/metadata.py

-10
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,3 @@ def get_property(self, name, default_value=None):
129129
}
130130
default_value = property_mapping.get(name, None)
131131
return super(SitePageMetadata, self).get_property(name, default_value)
132-
133-
def set_property(self, name, value, persist_changes=True):
134-
if name == "Id":
135-
if self._resource_path is None:
136-
self._resource_path = self.parent_collection.get_by_id(
137-
value
138-
).resource_path
139-
else:
140-
self._resource_path.patch(value)
141-
return super(SitePageMetadata, self).set_property(name, value, persist_changes)

office365/sharepoint/publishing/pages/page.py

+6
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,12 @@ def canvas_content(self):
218218
"""Gets the CanvasContent1 for the current Site Page"""
219219
return self.properties.get("CanvasContent1", None)
220220

221+
@property
222+
def language(self):
223+
# type: () -> Optional[str]
224+
"""Gets the Language for the Site Page."""
225+
return self.properties.get("Language", None)
226+
221227
@canvas_content.setter
222228
def canvas_content(self, value):
223229
# type: (str) -> None

office365/sharepoint/publishing/pages/service.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,25 @@ def communication_site(self):
5050
def entity_type_name(self):
5151
return "SP.Publishing.SitePageService"
5252

53-
def create_page(self, title):
54-
# type: (str) -> SitePage
53+
def create_page(self, title, language=None):
54+
# type: (str, Optional[str]) -> SitePage
5555
"""Create a new sitePage in the site pages list in a site.
5656
:param str title: The title of Site Page
57+
:param str language: The language of the Site Page.
5758
"""
5859

5960
def _page_created(return_type):
6061
# type: (SitePage) -> None
6162

6263
def _draft_saved(result):
6364
# type: (ClientResult[bool]) -> None
64-
pass
65+
return_type.get()
6566

6667
return_type.save_draft(title=title).after_execute(
6768
_draft_saved, execute_first=True
6869
)
6970

70-
return self.pages.add().after_execute(_page_created).get()
71+
return self.pages.add().after_execute(_page_created)
7172

7273
def create_and_publish_page(self, title):
7374
"""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class BrandCenterConfiguration(ClientValue):
5+
""" """

office365/sharepoint/sites/manager/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from office365.runtime.client_result import ClientResult
2+
from office365.runtime.paths.resource_path import ResourcePath
3+
from office365.runtime.queries.service_operation import ServiceOperationQuery
4+
from office365.sharepoint.entity import Entity
5+
from office365.sharepoint.sites.manager.types import TopSiteFilesResult
6+
7+
8+
class SiteManagerService(Entity):
9+
""" """
10+
11+
def __init__(self, context):
12+
static_path = ResourcePath(
13+
"Microsoft.SharePoint.SiteManager.SiteManagerService"
14+
)
15+
super(SiteManagerService, self).__init__(context, static_path)
16+
17+
def top_files(self, max_count=None):
18+
""" """
19+
return_type = ClientResult(self.context, TopSiteFilesResult())
20+
payload = {"maxCount": max_count}
21+
qry = ServiceOperationQuery(
22+
self,
23+
"TopFiles",
24+
None,
25+
payload,
26+
None,
27+
return_type,
28+
)
29+
self.context.add_query(qry)
30+
return return_type
31+
32+
@property
33+
def entity_type_name(self):
34+
return "Microsoft.SharePoint.SiteManager.SiteManagerService"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class TopSiteFilesResult(ClientValue):
5+
""" """

office365/sharepoint/sites/themes.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class SiteThemes(ClientValue):
5+
""" """

0 commit comments

Comments
 (0)