Skip to content

Commit 48eebbf

Browse files
directory,calendar, onedrive namespaces improvements (new types & methods)
1 parent e5ca51b commit 48eebbf

Some content is hidden

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

50 files changed

+354
-112
lines changed

examples/directory/delete_groups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
print("Group deleted.")
1414
index += 1
1515

16-
deleted_groups = client.directory.deleted_groups.get().execute_query()
16+
deleted_groups = client.directory.deletedGroups.get().execute_query()
1717
groups_count = len(deleted_groups)
1818
index = 0
1919
while len(deleted_groups) > 0:

examples/teams/send_message.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
from tests.graph_case import acquire_token_by_username_password
33

44
client = GraphClient(acquire_token_by_username_password)
5-
teams_result = client.me.joinedTeams.get().execute_query()
5+
teams_result = client.me.joined_teams.get().execute_query()
66
if len(teams_result) > 0:
77
target_team = teams_result[1]
88

9-
messages = target_team.primaryChannel.messages.get().execute_query()
9+
messages = target_team.primary_channel.messages.get().execute_query()
1010
print(messages)
1111

1212
# item_body = ItemBody("Hello world!")

office365/calendar/calendar.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ def get_schedule(self, schedules, startTime=None, endTime=None, availabilityView
3737
self.context.add_query(qry)
3838
return result
3939

40+
@property
41+
def can_edit(self):
42+
"""
43+
true if the user can write to the calendar, false otherwise.
44+
This property is true for the user who created the calendar.
45+
This property is also true for a user who has been shared a calendar and granted write access.
46+
47+
:rtype: bool or None
48+
"""
49+
return self.properties.get('canEdit', None)
50+
4051
@property
4152
def name(self):
4253
"""
@@ -59,7 +70,7 @@ def events(self):
5970
EventCollection(self.context, ResourcePath("events", self.resource_path)))
6071

6172
@property
62-
def calendarView(self):
73+
def calendar_view(self):
6374
"""The calendar view for the calendar. Navigation property. Read-only."""
6475
return self.properties.get('calendarView',
6576
EventCollection(self.context, ResourcePath("calendarView", self.resource_path)))

office365/calendar/event.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from office365.calendar.attendee import Attendee
2+
from office365.directory.extension import ExtensionCollection
23
from office365.mail.attachment_collection import AttachmentCollection
34
from office365.mail.item import Item
45
from office365.mail.location import Location
@@ -64,3 +65,16 @@ def attachments(self):
6465
"""The collection of fileAttachment and itemAttachment attachments for the event. """
6566
return self.properties.get('attachments',
6667
AttachmentCollection(self.context, ResourcePath("attachments", self.resource_path)))
68+
69+
@property
70+
def extensions(self):
71+
"""The collection of open extensions defined for the event. Nullable."""
72+
return self.properties.get('extensions',
73+
ExtensionCollection(self.context, ResourcePath("extensions", self.resource_path)))
74+
75+
@property
76+
def instances(self):
77+
"""The collection of open extensions defined for the event. Nullable."""
78+
from office365.calendar.event_collection import EventCollection
79+
return self.properties.get('instances',
80+
EventCollection(self.context, ResourcePath("instances", self.resource_path)))
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class OnlineMeetingProviderType:
2+
"""Specifies the type of a principal."""
3+
4+
def __init__(self):
5+
pass
6+
7+
unknown = 0
8+
skypeForBusiness = 1
9+
skypeForConsumer = 2
10+
teamsForBusiness = 3

office365/directory/application.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def delete_object(self, permanent_delete=False):
3737
"""
3838
super(Application, self).delete_object()
3939
if permanent_delete:
40-
deleted_item = self.context.directory.deleted_applications[self.id]
40+
deleted_item = self.context.directory.deletedApplications[self.id]
4141
deleted_item.delete_object()
4242
return self
4343

office365/directory/assignedLicense.py

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

33

44
class AssignedLicense(ClientValue):
5-
pass
5+
6+
def __init__(self, skuId=None, disabledPlans=None):
7+
super().__init__()
8+
self.skuId = skuId
9+
self.disabledPlans = disabledPlans

office365/directory/directory.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Directory(Entity):
88
"container". Deleted items will remain available to restore for up to 30 days. After 30 days, the items are
99
permanently deleted. """
1010

11-
def deleted_items(self, entity_type=None):
11+
def deletedItems(self, entity_type=None):
1212
"""Recently deleted items. Read-only. Nullable."""
1313
if entity_type:
1414
return DirectoryObjectCollection(self.context, ResourcePath(entity_type,
@@ -20,16 +20,16 @@ def deleted_items(self, entity_type=None):
2020
ResourcePath("deletedItems", self.resource_path)))
2121

2222
@property
23-
def deleted_groups(self):
23+
def deletedGroups(self):
2424
"""Recently deleted groups"""
25-
return self.deleted_items("microsoft.graph.group")
25+
return self.deletedItems("microsoft.graph.group")
2626

2727
@property
28-
def deleted_users(self):
28+
def deletedUsers(self):
2929
"""Recently deleted users"""
30-
return self.deleted_items("microsoft.graph.user")
30+
return self.deletedItems("microsoft.graph.user")
3131

3232
@property
33-
def deleted_applications(self):
33+
def deletedApplications(self):
3434
"""Recently deleted applications"""
35-
return self.deleted_items("microsoft.graph.application")
35+
return self.deletedItems("microsoft.graph.application")

office365/directory/directoryObjectCollection.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from office365.runtime.client_result import ClientResult
44
from office365.runtime.http.http_method import HttpMethod
55
from office365.runtime.queries.service_operation_query import ServiceOperationQuery
6-
from office365.runtime.resource_path import ResourcePath
76

87

98
class DirectoryObjectCollection(EntityCollection):

office365/directory/group.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
from office365.calendar.event_collection import EventCollection
44
from office365.directory.appRoleAssignment import AppRoleAssignmentCollection
5+
from office365.directory.assignedLicense import AssignedLicense
56
from office365.directory.directoryObject import DirectoryObject
67
from office365.directory.directoryObjectCollection import DirectoryObjectCollection
78
from office365.onedrive.driveCollection import DriveCollection
89
from office365.onedrive.siteCollection import SiteCollection
910
from office365.runtime.client_result import ClientResult
11+
from office365.runtime.client_value_collection import ClientValueCollection
1012
from office365.runtime.http.http_method import HttpMethod
1113
from office365.runtime.queries.service_operation_query import ServiceOperationQuery
1214
from office365.runtime.resource_path import ResourcePath
@@ -70,7 +72,7 @@ def delete_object(self, permanent_delete=False):
7072
"""
7173
super(Group, self).delete_object()
7274
if permanent_delete:
73-
deleted_item = self.context.directory.deleted_groups[self.id]
75+
deleted_item = self.context.directory.deletedGroups[self.id]
7476
deleted_item.delete_object()
7577
return self
7678

@@ -109,3 +111,8 @@ def appRoleAssignments(self):
109111
return self.properties.get('appRoleAssignments',
110112
AppRoleAssignmentCollection(self.context,
111113
ResourcePath("appRoleAssignments", self.resource_path)))
114+
115+
@property
116+
def assigned_licenses(self):
117+
return self.properties.get('assignedLicenses',
118+
ClientValueCollection(AssignedLicense))

0 commit comments

Comments
 (0)