Integrations/MicrosoftGraphFiles/MicrosoftGraphFiles.py
def download_file(self, object_type, object_type_id, item_id):
        """
        Download the contents of the file of a DriveItem.
        :param object_type: ms graph resource.
        :param object_type_id: the selected object type id.
        :param item_id: ms graph item_id.
        :return: graph api raw response
        """
        if object_type == "drives":
            url = f"{object_type}/{object_type_id}/items/{item_id}/content"

        elif object_type in ["groups", "sites", "users"]:
            url = f"{object_type}/{object_type_id}/drive/items/{item_id}/content"

        # send request
        url = self.base_url + f"/{url}"
        res = self.http_call(
            "GET", full_url=url, headers=self.headers, url_suffix="", resp_type=""
        )  # it needs
        # resp_type='' to stay empty because if response type is empty http_requests returned the raw response.
        # I need it because graph api returns an response as text without content so res.text fails
        return res

        Download the contents of the file of a DriveItem.
        :param object_type: ms graph resource.
        :param object_type_id: the selected object type id.
        :param item_id: ms graph item_id.
        :return: graph api raw response
        
Download the contents of the file of a DriveItem.
Download the contents of the file of a DriveItem .
def download_file(self, object_type, object_type_id, item_id):
        if object_type == "drives":
            url = f"{object_type}/{object_type_id}/items/{item_id}/content"
        elif object_type in ["groups", "sites", "users"]:
            url = f"{object_type}/{object_type_id}/drive/items/{item_id}/content"
        url = self.base_url + f"/{url}"
        res = self.http_call(
            "GET", full_url=url, headers=self.headers, url_suffix="", resp_type=""
        )  
        return res
def download_file ( self , object_type , object_type_id , item_id ) : if object_type == "drives" : url = f"{object_type}/{object_type_id}/items/{item_id}/content" elif object_type in [ "groups" , "sites" , "users" ] : url = f"{object_type}/{object_type_id}/drive/items/{item_id}/content" url = self . base_url + f"/{url}" res = self . http_call ( "GET" , full_url = url , headers = self . headers , url_suffix = "" , resp_type = "" ) return res
Download the contents of the file of a DriveItem.
Download the contents of the file of a DriveItem .
"""
        Download the contents of the file of a DriveItem.
        :param object_type: ms graph resource.
        :param object_type_id: the selected object type id.
        :param item_id: ms graph item_id.
        :return: graph api raw response
        """ # send request # it needs # resp_type='' to stay empty because if response type is empty http_requests returned the raw response. # I need it because graph api returns an response as text without content so res.text fails
graph api raw response
graph api raw response
self
object_type
ms graph resource.
ms graph resource .
object_type_id
the selected object type id.
the selected object type id .
item_id
ms graph item_id.
ms graph item_id .