def resource_path(self):
        resource_path = super(Attachmentfile, self).resource_path
        if resource_path:
            return resource_path

        # fallback: create a new resource path
        if self.is_property_available("ServerRelativeUrl"):
            self._resource_path = ResourcePathEntity(
                self.context, ResourcePathEntity(self.context, None, "Web"),
                ODataPathParser.from_method(
                    "GetFileByServerRelativeUrl",
                    [self.properties["ServerRelativeUrl"]]))

        return self._resource_path
Beispiel #2
0
 def users(self):
     """Gets a collection of user objects that represents all of the users in the group."""
     from spoklient.sharepoint.user_collection import UserCollection
     if self.is_property_available('Users'):
         return self.properties['Users']
     else:
         return UserCollection(self.context, ResourcePathEntity(self.context, self.resource_path, "Users"))
Beispiel #3
0
 def file(self):
     """Get file"""
     if self.is_property_available("File"):
         return self.properties["File"]
     else:
         from spoklient.sharepoint.file import File
         return File(self.context, ResourcePathEntity(self.context, self.resource_path, "File"))
Beispiel #4
0
    def resource_path(self):
        resource_path = super(Principal, self).resource_path
        if resource_path:
            return resource_path

        # fallback: create a new resource path
        if self.is_property_available("Id"):
            self._resource_path = ResourcePathEntity(
                self.context, self._parent_collection.resource_path,
                ODataPathParser.from_method("GetById",
                                            [self.properties["Id"]]))
        elif self.is_property_available("LoginName"):
            self._resource_path = ResourcePathEntity(
                self.context, self._parent_collection.resource_path,
                ODataPathParser.from_method("GetByName",
                                            [self.properties["LoginName"]]))
Beispiel #5
0
 def folder(self):
     """Get folder"""
     if self.is_property_available("Folder"):
         return self.properties["Folder"]
     else:
         from spoklient.sharepoint.folder import Folder
         return Folder(self.context, ResourcePathEntity(self.context, self.resource_path, "Folder"))
Beispiel #6
0
 def root(self):
     """The root folder of the drive."""
     if self.is_property_available("root"):
         return self.properties['root']
     else:
         return DriveItem(
             self.context,
             ResourcePathEntity(self.context, self.resource_path, "root"))
Beispiel #7
0
 def view_fields(self):
     if self.is_property_available('ViewFields'):
         return self.properties['ViewFields']
     else:
         return ViewFieldCollection(
             self.context,
             ResourcePathEntity(self.context, self.resource_path,
                                "ViewFields"))
Beispiel #8
0
 def attachment_files(self):
     """Get attachment files"""
     if self.is_property_available('AttachmentFiles'):
         return self.properties["AttachmentFiles"]
     else:
         from spoklient.sharepoint.attachmentfile_collection import AttachmentfileCollection
         return AttachmentfileCollection(self.context,
                                         ResourcePathEntity(self.context, self.resource_path, "AttachmentFiles"))
Beispiel #9
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,
             ResourcePathEntity(self.context, self.resource_path,
                                "ListItemAllFields"))
Beispiel #10
0
 def files(self):
     """Get a file collection"""
     if self.is_property_available('Files'):
         return self.properties["Files"]
     else:
         from spoklient.sharepoint.file_collection import FileCollection
         return FileCollection(
             self.context,
             ResourcePathEntity(self.context, self.resource_path, "Files"))
Beispiel #11
0
 def root_web(self):
     """Get root web"""
     if self.is_property_available('RootWeb'):
         return self.properties['RootWeb']
     else:
         return Web(
             self.context,
             ResourcePathEntity(self.context, self.resource_path,
                                "RootWeb"))
Beispiel #12
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:
         from spoklient.sharepoint.group_collection import GroupCollection
         return GroupCollection(
             self.context,
             ResourcePathEntity(self.context, self.resource_path, "Groups"))
Beispiel #13
0
 def resource_path(self):
     resource_path = super(BaseItem, self).resource_path
     if resource_path:
         return resource_path
     if self.is_property_available("Id"):
         return ResourcePathEntity(
             self.context,
             self._parent_collection.resource_path,
             self.properties["Id"])
Beispiel #14
0
    def resource_path(self):
        resource_path = super(OutlookEntity, self).resource_path
        if resource_path:
            return resource_path

        # fallback: create a new resource path
        if self.is_property_available("Id"):
            return ResourcePathEntity(self.context,
                                      self._parent_collection.resource_path,
                                      self.properties["Id"])
Beispiel #15
0
 def folders(self):
     """Get a folder collection"""
     if self.is_property_available('Folders'):
         return self.properties["Folders"]
     else:
         from spoklient.sharepoint.folder_collection import FolderCollection
         return FolderCollection(
             self.context,
             ResourcePathEntity(self.context, self.resource_path,
                                "Folders"))
Beispiel #16
0
    def resource_path(self):
        resource_path = super(Folder, self).resource_path
        if resource_path:
            return resource_path

        # fallback: create a new resource path
        if self.is_property_available("ServerRelativeUrl"):
            self._resource_path = ResourcePathEntity(
                self.context, ResourcePathEntity.from_uri("Web", self.context),
                ODataPathParser.from_method(
                    "GetFolderByServerRelativeUrl",
                    [self.properties["ServerRelativeUrl"]]))
        elif self.is_property_available("UniqueId"):
            self._resource_path = ResourcePathEntity(
                self.context, ResourcePathEntity.from_uri("Web", self.context),
                ODataPathParser.from_method(
                    "GetFolderById", [{
                        'guid': self.properties["UniqueId"]
                    }]))
        return self._resource_path
Beispiel #17
0
 def webs(self):
     """Get child webs"""
     if self.is_property_available('Webs'):
         return self.properties['Webs']
     else:
         from spoklient.sharepoint.web_collection import WebCollection
         parent_web_url = None
         if self.is_property_available('Url'):
             parent_web_url = self.properties['Url']
         return WebCollection(self.context,
                              ResourcePathEntity(self.context, self.resource_path, "webs"),
                              parent_web_url)
Beispiel #18
0
    def resource_path(self):
        resource_path = super(ListItem, self).resource_path
        if resource_path:
            return resource_path

        # fallback: create a new resource path
        if self.is_property_available("Id"):
            self._resource_path = ResourcePathEntity(
                self.context,
                self._parent_collection.resource_path,
                ODataPathParser.from_method("getItemById", [self.properties["Id"]]))

        return self._resource_path
Beispiel #19
0
 def folders(self):
     """Get folder resources"""
     if self.is_property_available('Folders'):
         return self.properties['Folders']
     else:
         return FolderCollection(self.context, ResourcePathEntity(self.context, self.resource_path, "folders"))
Beispiel #20
0
 def lists(self):
     """Get web list collection"""
     if self.is_property_available('Lists'):
         return self.properties['Lists']
     else:
         return ListCollection(self.context, ResourcePathEntity(self.context, self.resource_path, "lists"))
Beispiel #21
0
 def site_users(self):
     """Get site users"""
     if self.is_property_available('SiteUsers'):
         return self.properties['SiteUsers']
     else:
         return UserCollection(self.context, ResourcePathEntity(self.context, self.resource_path, "siteusers"))
Beispiel #22
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, ResourcePathEntity(self.context, self.resource_path, "listItemAllFields"))
Beispiel #23
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, ResourcePathEntity(self.context, self.resource_path, "sitegroups"))
Beispiel #24
0
 def __init__(self, context):
     super(Site, self).__init__(context,
                                ResourcePathEntity(context, None, "Site"))
 def get_by_id(self, contact_id):
     """Retrieve Contact resource by id"""
     return Contact(
         self.context,
         ResourcePathEntity(self.context, self.resource_path, contact_id))
 def get_by_id(self, drive_id):
     """Retrieve Drive by unique identifier"""
     return Drive(
         self.context,
         ResourcePathEntity(self.context, self.resource_path, drive_id))
 def me(self):
     """The Me endpoint is provided as a shortcut for specifying the current user by SMTP address."""
     return User(self, ResourcePathEntity(self, None, "me"))
Beispiel #28
0
 def item_with_path(self, path):
     """Retrieve DriveItem by path"""
     return DriveItem(
         self.context,
         ResourcePathEntity(self.context, self.resource_path,
                            ':/{0}'.format(path)))
Beispiel #29
0
 def drives(self):
     """Get one drives"""
     return DriveCollection(self, ResourcePathEntity(self, None, "drives"))
Beispiel #30
0
 def __init__(self, context, resource_path=None):
     if resource_path is None:
         resource_path = ResourcePathEntity(context, None, "Web")
     super(Web, self).__init__(context, resource_path)
     self._web_path = None