FOLDER_RESOURCE_KEY: Üst klasörün kaynak anahtarı.
USER_ID: Kullanıcıyı benzersiz şekilde tanımlayan profil kimliği.
Uygulamanızın bu isteği işleme almak için şu adımları uygulaması gerekir:
action alanının değerinin create olduğundan emin olun.
Kullanıcı için yeni bir oturum oluşturmak üzere userId değerini kullanın. Oturum açmış kullanıcılar hakkında daha fazla bilgi için Kullanıcılar ve yeni etkinlikler başlıklı makaleyi inceleyin.
Dosya kaynağı oluşturmak için files.create yöntemini kullanın. İstek üzerinde folderId ayarlandıysa parents alanını folderId değeri olarak ayarlayın.
state parametresi URL biçiminde kodlanmıştır. Bu nedenle, uygulamanız kaçış karakterlerini işlemeli ve JSON olarak ayrıştırmalıdır.
Kullanıcılar ve yeni etkinlikler
Drive uygulamaları, tüm "oluşturma" etkinliklerini olası oturum açma işlemleri olarak değerlendirmelidir. Bazı kullanıcıların birden fazla hesabı olabilir. Bu nedenle, state parametresindeki kullanıcı kimliği mevcut oturumla eşleşmeyebilir. state parametresindeki kullanıcı kimliği geçerli oturumla eşleşmiyorsa uygulamanızın geçerli oturumunu sonlandırın ve istenen kullanıcı olarak oturum açın.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-08-04 UTC."],[],[],null,["# Integrate with Drive UI's "New" button\n\nWhen a user clicks [Drive UI's \"New\"\nbutton](/workspace/drive/api/guides/about-apps#new) and selects an app in the\nDrive UI, Drive redirects the user to that app's New URL\ndefined in [Configure a Drive UI\nintegration](/workspace/drive/api/guides/enable-sdk).\n\nYour app then receives a default set of template variables within a\n[`state`](/workspace/drive/api/guides/enable-sdk#construct) parameter. The default `state`\ninformation for a New URL is: \n\n {\n \"action\":\"create\",\n \"folderId\":\"\u003cvar translate=\"no\"\u003eFOLDER_ID\u003c/var\u003e\",\n \"folderResourceKey\":\"\u003cvar translate=\"no\"\u003eFOLDER_RESOURCE_KEY\u003c/var\u003e\",\n \"userId\":\"\u003cvar translate=\"no\"\u003eUSER_ID\u003c/var\u003e\"\n }\n\nThis output includes the following values:\n\n- `create`: The action being performed. The value is `create` when a user clicks [Drive UI's \"New\"\n button](/workspace/drive/api/guides/about-apps#new).\n- \u003cvar translate=\"no\"\u003eFOLDER_ID\u003c/var\u003e: The ID of the parent folder.\n- \u003cvar translate=\"no\"\u003eFOLDER_RESOURCE_KEY\u003c/var\u003e: The resource key of the parent folder.\n- \u003cvar translate=\"no\"\u003eUSER_ID\u003c/var\u003e: The profile ID that uniquely identifies the user.\n\nYour app must act on this request by following these steps:\n\n1. Verify that the `action` field has a value of `create`.\n2. Use the `userId` value to create a new session for the user. For more information on signed-in users, see [Users \\& new events](#potential-logins).\n3. Use the [`files.create`](/workspace/drive/api/v3/reference/files/create) method to create a file resource. If `folderId` was set on the request, set the `parents` field to the `folderId` value.\n4. 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\n keys](/workspace/drive/api/guides/resource-keys).\n\nThe `state` parameter is URL-encoded, so your app must handle the escape\ncharacters and parse it as JSON.\n\nUsers \\& new events\n-------------------\n\nDrive apps should treat all \"create\" events as potential\nsign-ins. Some users might have multiple accounts, so the user ID in the `state`\nparameter might not match the current session. If the user ID in the `state`\nparameter doesn't match the current session, end the current session for your\napp and sign in as the requested user."]]