با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
برای اینکه به کاربران اجازه دهید فایلهای Drive را مستقیماً از برنامه شما به اشتراک بگذارند، میتوانید از گفتگوی اشتراکگذاری Google Drive استفاده کنید. این گفتگوی مدال از برنامه شما فراخوانی می شود تا امکان اشتراک گذاری موارد در Drive را فراهم کند. شکل 1 دکمه اشتراک گذاری اسناد Google و گفتگوی اشتراک گذاری حاصل را نشان می دهد.
شکل 1. دکمه اشتراک گذاری و گفتگو.
برای فعال کردن گفتگوی اشتراکگذاری درایو، اسکریپت گفتگو و یک دکمه راهاندازی یا مکانیزم راهاندازی دیگر را به رابط کاربری خود اضافه کنید.
اسکریپت گفتگو را اضافه کنید
برای ایجاد نمونه ای از گفتگوی اشتراک گذاری، اسکریپت زیر را به صفحه راه اندازی خود اضافه کنید:
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# Display the sharing dialog\n\nTo allow users to share Drive files directly from your app, you can use the\nGoogle Drive sharing dialog. This modal dialog is invoked\nfrom your app to allow sharing of items on Drive. Figure 1 shows the Google Docs\nShare button and the resulting sharing dialog.\n**Figure 1.** Share button and dialog.\n\nTo enable the Drive sharing dialog, add the dialog script and a launch button\nor other launching mechanism to your UI.\n\n### Add the dialog script\n\nTo create an instance of the sharing dialog, add the following script to your\nlaunching page: \n\n \u003chead\u003e\n ...\n \u003cscript type=\"text/javascript\" src=\"https://apis.google.com/js/api.js\"\u003e\u003c/script\u003e\n \u003cscript type=\"text/javascript\"\u003e\n init = function() {\n s = new gapi.drive.share.ShareClient();\n s.setOAuthToken('\u003cOAUTH_TOKEN\u003e');\n s.setItemIds(['\u003cFILE_ID\u003e']);\n }\n window.onload = function() {\n gapi.load('drive-share', init);\n }\n \u003c/script\u003e\n \u003c/head\u003e\n\nWhere:\n\n- `\u003cOAUTH_TOKEN\u003e` should be replaced with the [authorized user's OAuth2 access token](/workspace/drive/api/guides/about-auth).\n- `\u003cFILE_ID\u003e` should be replaced with the id of the file to share.\n\n### Add a launch button\n\nIn your UI, add a line of code similar to the following: \n\n \u003cbutton onclick=\"s.showSettingsDialog()\"\u003eShare\u003c/button\u003e\n\nThis code calls the `showSettingsDialog()` function when the Share button is\nclicked.\n| **Note:** For the dialog to work as expected, third-party party cookies must be enabled and the user must be currently signed in to the Google account matching the identity of the oauth token."]]