Integrations/MicrosoftGraphFiles/MicrosoftGraphFiles.py
def replace_existing_file(self, object_type, object_type_id, item_id, entry_id):
        """
        replace file context in MS Graph resource
        :param object_type: ms graph resource.
        :param object_type_id: ms graph resource id.
        :param item_id: item_id: ms graph item_id.
        :param entry_id: demisto file entry id
        :return: graph api raw response
        """

        file_path = demisto.getFilePath(entry_id).get("path", None)
        if not file_path:
            raise DemistoException(
                f"Could not find file path to the next entry id: {entry_id}. \n"
                f"Please provide another one."
            )
        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}"
        with open(file_path, "rb") as file:
            self.headers["Content-Type"] = "application/octet-stream"
            return self.http_call(
                "PUT", full_url=url, data=file, headers=self.headers, url_suffix=""
            )

        replace file context in MS Graph resource
        :param object_type: ms graph resource.
        :param object_type_id: ms graph resource id.
        :param item_id: item_id: ms graph item_id.
        :param entry_id: demisto file entry id
        :return: graph api raw response
        
replace file context in MS Graph resource
replace file context in MS Graph resource
def replace_existing_file(self, object_type, object_type_id, item_id, entry_id):
        file_path = demisto.getFilePath(entry_id).get("path", None)
        if not file_path:
            raise DemistoException(
                f"Could not find file path to the next entry id: {entry_id}. \n"
                f"Please provide another one."
            )
        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}"
        with open(file_path, "rb") as file:
            self.headers["Content-Type"] = "application/octet-stream"
            return self.http_call(
                "PUT", full_url=url, data=file, headers=self.headers, url_suffix=""
            )
def replace_existing_file ( self , object_type , object_type_id , item_id , entry_id ) : file_path = demisto . getFilePath ( entry_id ) . get ( "path" , None ) if not file_path : raise DemistoException ( f"Could not find file path to the next entry id: {entry_id}. \n" f"Please provide another one." ) 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}" with open ( file_path , "rb" ) as file : self . headers [ "Content-Type" ] = "application/octet-stream" return self . http_call ( "PUT" , full_url = url , data = file , headers = self . headers , url_suffix = "" )
replace file context in MS Graph resource
replace file context in MS Graph resource
"""
        replace file context in MS Graph resource
        :param object_type: ms graph resource.
        :param object_type_id: ms graph resource id.
        :param item_id: item_id: ms graph item_id.
        :param entry_id: demisto file entry id
        :return: graph api raw response
        """ # send request
graph api raw response
graph api raw response
self
object_type
ms graph resource.
ms graph resource .
object_type_id
ms graph resource id.
ms graph resource id .
item_id
ms graph item_id.
ms graph item_id .
entry_id
demisto file entry id
demisto file entry id