create: The action being performed. The value is create when a user
clicks Drive UI's "New"
button.
FOLDER_ID: The ID of the parent folder.
FOLDER_RESOURCE_KEY: The resource key of the parent folder.
USER_ID: The profile ID that uniquely identifies the
user.
Your app must act on this request by following these steps:
Verify that the action field has a value of create.
Use the userId value to create a new session for the user. For more
information on signed-in users, see Users & new events.
Use the files.create method to
create a file resource. If folderId was set on the request, set the
parents field to the folderId value.
If folderResourceKey was set on the request, set the
X-Goog-Drive-Resource-Keys request header. For more information on
resource keys, see Access link-shared files using resource
keys.
The state parameter is URL-encoded, so your app must handle the escape
characters and parse it as JSON.
Users & new events
Drive apps should treat all "create" events as potential
sign-ins. Some users might have multiple accounts, so the user ID in the state
parameter might not match the current session. If the user ID in the state
parameter doesn't match the current session, end the current session for your
app and sign in as the requested user.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-24 UTC."],[[["When a user creates a new file with your app from Drive UI, your app receives a `state` parameter containing action, folder details, and user ID."],["Your app should verify the `action` is \"create\", create a user session, and use the provided information to create a new file via the Drive API."],["All \"create\" events should be treated as potential sign-ins and handled to accommodate users with multiple accounts, potentially requiring session switching."],["The `state` parameter is URL-encoded and needs to be parsed as JSON by your application for proper data extraction."]]],["When a user selects an app via Drive UI's \"New\" button, Drive redirects to the app's New URL, sending a `state` parameter. The `state` includes `action` (set to \"create\"), `folderId`, `folderResourceKey`, and `userId`. The app must verify the `action`, initiate a new user session based on `userId`, use `files.create` to generate a file resource, and handle `folderId` and `folderResourceKey`. All \"create\" events should be treated as potential sign-ins, with user sessions adjusted accordingly. The `state` parameter is URL-encoded JSON and must be parsed.\n"]]