Google workspace Addon: Request File Scope for multiple files at once

Viewed 63

I am working on Drive Add-on and got stuck when I tried to request the file scope of multiple files at once.

I am using the CardService system via an alternate runtime (no Apps Script).

SUCCESSFUL Working case: To do the request of the file scope for one file I am doing:

@root_router.post('/on_items_selected', response_class=JSONResponse)
async def on_items_selected(request: Request):
    card = {"renderActions":
             {"hostAppAction": 
                {"driveAction":
                  {"requestFileScope": {"itemId": "0BzCCD97ant74akBrTHY1eUg5d0k" }
                  }
               }
             }
           }

    return card

How can I request the file scope of multiple files at once?

Failing request: I tried the code below but it does not work.

@root_router.post('/on_items_selected', response_class=JSONResponse)
async def on_items_selected(request: Request):
    card = {"renderActions":
             {"hostAppAction": 
               {"driveAction": 
                 {"requestFileScope": [{"itemId": "0BzCCD97ant74akBrTHY1eUg5d0k"},
                                   {"itemId": "5BzCCD97ant74akBrTHY1eUg5d0k"}]
                 }
               }
             }
           }
    return card

See below the error:

Error with the add-on.
Run time error.
Expect message object but got: [{"itemId":"0BzCCD97ant74RkF0N2pRWmRUYTg"},{"itemId":"0BzCCD97ant74a1BrTHY1eUg5d0

enter image description here

0 Answers
Related