예제 #1
0
 def resource_path(self):
     orig_path = ClientObject.resource_path.fget(self)
     if self.is_property_available(
             "ServerRelativeUrl") and orig_path is None:
         return ResourcePathEntry(
             self.context, self.context.web.resource_path,
             "GetFolderByServerRelativeUrl('{0}')".format(
                 self.properties["ServerRelativeUrl"]))
     elif self.is_property_available("UniqueId") and orig_path is None:
         return ResourcePathEntry(
             self.context, self.context.web.resource_path,
             "GetFolderById(guid'{0}')".format(self.properties["UniqueId"]))
     return orig_path
예제 #2
0
 def contacts(self):
     """Get a contact collection from the default Contacts folder of the signed-in user (.../me/contacts),
     or from the specified contact folder."""
     contacts = ContactCollection(
         self.context,
         ResourcePathEntry(self, self._resource_path, "contacts"))
     return contacts
예제 #3
0
 def resource_path(self):
     orig_path = ClientObject.resource_path.fget(self)
     if self.is_property_available("Id") and orig_path is None:
         return ResourcePathEntry(self.context,
                                  self._parent_collection.resource_path,
                                  self.properties["Id"])
     return orig_path
예제 #4
0
 def files(self):
     """Get a file collection"""
     if self.is_property_available('Files'):
         return self.properties["Files"]
     else:
         return FileCollection(
             self.context,
             ResourcePathEntry(self.context, self.resource_path, "Files"))
예제 #5
0
 def root_web(self):
     """Get root web"""
     if self.is_property_available('RootWeb'):
         return self.properties['RootWeb']
     else:
         return Web(
             self.context,
             ResourcePathEntry(self.context, self.resource_path, "RootWeb"))
예제 #6
0
 def lists(self):
     """Get web list collection"""
     if self.is_property_available('Lists'):
         return self.properties['Lists']
     else:
         return ListCollection(
             self.context,
             ResourcePathEntry(self.context, self.resource_path, "lists"))
예제 #7
0
 def users(self):
     """Gets a collection of user objects that represents all of the users in the group."""
     if self.is_property_available('Users'):
         return self.properties['Users']
     else:
         return UserCollection(
             self.context,
             ResourcePathEntry(self.context, self.resource_path, "Users"))
예제 #8
0
 def webs(self):
     """Get child webs"""
     if self.is_property_available('Webs'):
         return self.properties['Webs']
     else:
         return WebCollection(
             self.context,
             ResourcePathEntry(self.context, self.resource_path, "webs"))
예제 #9
0
 def folders(self):
     """Get folder resources"""
     if self.is_property_available('Folders'):
         return self.properties['Folders']
     else:
         return FolderCollection(
             self.context,
             ResourcePathEntry(self.context, self.resource_path, "folders"))
예제 #10
0
 def groups(self):
     """Gets a collection of group objects that represents all of the groups for the user."""
     if self.is_property_available('Groups'):
         return self.properties['Groups']
     else:
         return GroupCollection(
             self.context,
             ResourcePathEntry(self.context, self.resource_path, "Groups"))
예제 #11
0
 def site_users(self):
     """Get site users"""
     if self.is_property_available('SiteUsers'):
         return self.properties['SiteUsers']
     else:
         return UserCollection(
             self.context,
             ResourcePathEntry(self.context, self.resource_path,
                               "siteusers"))
예제 #12
0
 def root_folder(self):
     """Get a root folder"""
     if self.is_property_available('RootFolder'):
         return self.properties["RootFolder"]
     else:
         return Folder(
             self.context,
             ResourcePathEntry(self.context, self.resource_path,
                               "RootFolder"))
예제 #13
0
 def site_groups(self):
     """Gets the collection of groups for the site collection."""
     if self.is_property_available('SiteGroups'):
         return self.properties['SiteGroups']
     else:
         return GroupCollection(
             self.context,
             ResourcePathEntry(self.context, self.resource_path,
                               "sitegroups"))
예제 #14
0
 def list_item_all_fields(self):
     """Specifies the list item field (2) values for the list item corresponding to the folder."""
     if self.is_property_available('ListItemAllFields'):
         return self.properties["ListItemAllFields"]
     else:
         return ListItem(
             self.context,
             ResourcePathEntry(self.context, self.resource_path,
                               "ListItemAllFields"))
예제 #15
0
 def current_user(self):
     """Gets the current user."""
     if self.is_property_available('CurrentUser'):
         return self.properties['CurrentUser']
     else:
         return User(
             self.context,
             ResourcePathEntry(self.context, self.resource_path,
                               "CurrentUser"))
예제 #16
0
 def listitem_allfields(self):
     """Gets a value that specifies the list item field values for the list item corresponding to the file."""
     if self.is_property_available('ListItemAllFields'):
         return self.properties['ListItemAllFields']
     else:
         return ListItem(
             self.context,
             ResourcePathEntry(self.context, self.resource_path,
                               "listItemAllFields"))
예제 #17
0
 def views(self):
     """Gets a value that specifies the collection of all public views on the list and personal views
     of the current user on the list."""
     if self.is_property_available('Views'):
         return self.properties['Views']
     else:
         return ViewCollection(
             self.context,
             ResourcePathEntry(self.context, self.resource_path, "views"))
예제 #18
0
 def content_types(self):
     """Gets the content types that are associated with the list."""
     if self.is_property_available('ContentTypes'):
         return self.properties['ContentTypes']
     else:
         return ContentTypeCollection(
             self.context,
             ResourcePathEntry(self.context, self.resource_path,
                               "contenttypes"))
예제 #19
0
 def events(self):
     """Get an event collection or an event."""
     events = EventCollection(
         self.context, ResourcePathEntry(self, self._resource_path,
                                         "events"))
     return events
예제 #20
0
 def messages(self):
     """Get an event collection or an event."""
     messages = MessageCollection(
         self.context,
         ResourcePathEntry(self, self._resource_path, "messages"))
     return messages
예제 #21
0
 def __init__(self, context, resource_path=None):
     if resource_path is None:
         resource_path = ResourcePathEntry(context, None, "Web")
     super(Web, self).__init__(context, resource_path)
예제 #22
0
 def me(self):
     """The Me endpoint is provided as a shortcut for specifying the current user by SMTP address."""
     return User(self, ResourcePathEntry(self, None, "me"))
예제 #23
0
 def get_by_id(self, contact_id):
     """Retrieve Contact resource by id"""
     return Contact(
         self.context,
         ResourcePathEntry(self.context, self.resource_path, contact_id))
예제 #24
0
 def __init__(self, context):
     super(Site, self).__init__(context,
                                ResourcePathEntry(context, None, "Site"))
예제 #25
0
 def get_items(self):
     """Returns a collection of items from the list based on the specified query."""
     items = ListItemCollection(
         self.context,
         ResourcePathEntry(self.context, self.resource_path, "items"))
     return items