@@ -6,3 +6,35 @@ class ChangeCollection(ClientObjectCollection):
6
6
7
7
def __init__ (self , context , resource_path = None ):
8
8
super (ChangeCollection , self ).__init__ (context , Change , resource_path )
9
+
10
+ def create_typed_object (self , properties ):
11
+ self .resolve_change_type (properties )
12
+ return super (ChangeCollection , self ).create_typed_object (properties )
13
+
14
+ def resolve_change_type (self , properties ):
15
+ """
16
+
17
+ :type properties: dict
18
+ """
19
+ from office365 .sharepoint .changes .change_user import ChangeUser
20
+ from office365 .sharepoint .changes .change_group import ChangeGroup
21
+ from office365 .sharepoint .changes .change_list import ChangeList
22
+ from office365 .sharepoint .changes .change_web import ChangeWeb
23
+ from office365 .sharepoint .changes .change_content_type import ChangeContentType
24
+ from office365 .sharepoint .changes .change_alert import ChangeAlert
25
+ from office365 .sharepoint .changes .change_field import ChangeField
26
+
27
+ if "WebId" in properties :
28
+ self ._item_type = ChangeWeb
29
+ elif "UserId" in properties :
30
+ self ._item_type = ChangeUser
31
+ elif "GroupId" in properties :
32
+ self ._item_type = ChangeGroup
33
+ elif "ListId" in properties :
34
+ self ._item_type = ChangeList
35
+ elif "ContentTypeId" in properties :
36
+ self ._item_type = ChangeContentType
37
+ elif "AlertId" in properties :
38
+ self ._item_type = ChangeAlert
39
+ elif "FieldId" in properties :
40
+ self ._item_type = ChangeField
0 commit comments