Пример #1
0
    def _build_empty_file_query(self, files):
        info = FileCreationInformation()
        info.url = self.file_name
        info.overwrite = True

        qry = create_file_query(files, info)
        self.context.after_execute(self._build_upload_session_query)
        return qry
Пример #2
0
    def add(self, file_creation_information):
        """Creates a File resource

        :type file_creation_information: office365.sharepoint.files.file_creation_information.FileCreationInformation
        :rtype: office365.sharepoint.files.file.File
        """
        qry = create_file_query(self, file_creation_information)
        self.context.add_query(qry)
        return qry.return_type
Пример #3
0
    def upload(self, file_name, content):
        """Uploads a file into folder

        :type file_name: str
        :type content: bytes or str
        :rtype: office365.sharepoint.files.file.File
        """
        info = FileCreationInformation(url=file_name,
                                       overwrite=True,
                                       content=content)
        qry = create_file_query(self, info)
        self.context.add_query(qry)
        return qry.return_type