একটি ফাইল থেকে একটি লেবেল সরান
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
এই পৃষ্ঠাটি বর্ণনা করে যে কীভাবে একটি একক Google ড্রাইভ ফাইলে একটি লেবেল সরাতে হয়৷
একটি ফাইল থেকে ফাইল লেবেল মেটাডেটা অপসারণ করতে, files.modifyLabels
পদ্ধতি ব্যবহার করুন। অনুরোধের মূল অংশে একটি ফাইলের লেবেলগুলির সেট পরিবর্তন করার জন্য ModifyLabelsRequest
এর একটি উদাহরণ রয়েছে৷ অনুরোধে কিছু পরিবর্তন থাকতে পারে যা পারমাণবিকভাবে প্রয়োগ করা হয়। অর্থাৎ, যদি কোনো পরিবর্তন বৈধ না হয়, তাহলে সম্পূর্ণ আপডেটটি ব্যর্থ হয় এবং (সম্ভাব্যভাবে নির্ভরশীল) পরিবর্তনগুলির কোনোটিই প্রয়োগ করা হয় না।
ModifyLabelsRequest
এ LabelModification
এর একটি উদাহরণ রয়েছে যা একটি ফাইলের লেবেলে একটি পরিবর্তন। এটিতে FieldModification
এর একটি উদাহরণও থাকতে পারে যা একটি লেবেলের ক্ষেত্রের একটি পরিবর্তন। ফাইল থেকে লেবেলটি সরাতে FieldModification.removeLabel
সেট করুন True
।
সফল হলে, প্রতিক্রিয়া বডিতে অনুরোধ দ্বারা যোগ করা বা আপডেট করা লেবেলগুলি থাকে৷ এগুলি Label
টাইপের একটি modifiedLabels
লেবেল অবজেক্টের মধ্যে বিদ্যমান।
উদাহরণ
নিম্নলিখিত কোড নমুনা দেখায় কিভাবে labelId
ব্যবহার করে fileId
ব্যবহার করে লেবেলের সাথে যুক্ত সমস্ত ক্ষেত্র সরাতে হয়। উদাহরণস্বরূপ, যদি একটি লেবেলে পাঠ্য এবং ব্যবহারকারী ক্ষেত্র উভয়ই থাকে তবে একটি লেবেল অপসারণ করলে লেবেলের সাথে যুক্ত পাঠ্য এবং ব্যবহারকারী ক্ষেত্র উভয়ই মুছে যায়। যেখানে, পাঠ্য ক্ষেত্রটি আনসেট করা এটিকে লেবেল থেকে সরিয়ে দেয় তবে ব্যবহারকারীর ক্ষেত্রটিকে স্পর্শ না করে। আরও তথ্যের জন্য, একটি ফাইলে একটি লেবেল ক্ষেত্র আনসেট করুন দেখুন।
জাভা
ModifyLabelsRequest modifyLabelsRequest =
new ModifyLabelsRequest()
.setLabelModifications(
ImmutableList.of(
new LabelModification()
.setLabelId("LABEL_ID")
.setRemoveLabel(true)));
ModifyLabelsResponse modifyLabelsResponse = driveService.files().modifyLabels("FILE_ID", modifyLabelsRequest).execute();
পাইথন
label_modification = {'labelId':'LABEL_ID', 'removeLabel': True]}
modified_labels = drive_service.files().modifyLabels(fileId="FILE_ID", body = {'labelModifications' : [label_modification]}).execute();
Node.js
/**
* Remove a label on a Drive file
* @return{obj} updated label data
**/
async function removeLabel() {
// Get credentials and build service
// TODO (developer) - Use appropriate auth mechanism for your app
const {GoogleAuth} = require('google-auth-library');
const {google} = require('googleapis');
const auth = new GoogleAuth({scopes: 'https://www.googleapis.com/auth/drive'});
const service = google.drive({version: 'v3', auth});
const labelModification = {
'labelId': 'LABEL_ID',
'removeLabel': True,
};
const labelModificationRequest = {
'labelModifications': [labelModification],
};
try {
const updateResponse = await service.files.modifyLabels({
fileId: 'FILE_ID',
resource: labelModificationRequest,
});
return updateResponse;
} catch (err) {
// TODO (developer) - Handle error
throw err;
}
নিম্নলিখিতগুলি প্রতিস্থাপন করুন:
- LABEL_ID : লেবেলের
labelId
পরিবর্তন করার জন্য। একটি ফাইলে লেবেল সনাক্ত করতে, files.listLabels
পদ্ধতি ব্যবহার করুন। - FILE_ID : ফাইলের
fileId
যার জন্য লেবেলগুলি পরিবর্তন করা হয়েছে৷
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-09-02 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-09-02 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["This page describes how to remove a label on a single Google Drive file.\n\nTo remove the file label metadata from a file, use the\n[`files.modifyLabels`](/workspace/drive/api/v2/reference/files/modifyLabels) method. The\n[request body](/workspace/drive/api/reference/rest/v2/files/modifyLabels#request-body)\ncontains an instance of\n[`ModifyLabelsRequest`](/workspace/drive/api/reference/rest/v2/files/modifyLabels#modifylabelsrequest)\nto modify the set of labels on a file. The request might contain several\nmodifications that are applied atomically. That is, if any modifications aren't\nvalid, then the entire update is unsuccessful and none of the (potentially\ndependent) changes are applied.\n\nThe `ModifyLabelsRequest` contains an instance of\n[`LabelModification`](/workspace/drive/api/reference/rest/v2/files/modifyLabels#labelmodification)\nwhich is a modification to a label on a file. It might also contain an instance\nof\n[`FieldModification`](/workspace/drive/api/reference/rest/v2/files/modifyLabels#fieldmodification)\nwhich is a modification to a label's field. To remove the label from the file,\nset `FieldModification.removeLabel` to `True`.\n\nIf successful, the [response\nbody](/workspace/drive/api/reference/rest/v2/files/modifyLabels#response-body) contains\nthe labels added or updated by the request. These exist within a\n`modifiedLabels` object of type [`Label`](/workspace/drive/api/reference/rest/v2/Label).\n\nExample\n\nThe following code sample shows how to use the `labelId` to remove all fields\nassociated with the label using the `fileId`. For example, if a label contains\nboth text and user fields, removing a label deletes *both* the text and user\nfields associated with the label. Whereas, unsetting the text field removes it\nfrom the label but leaves the user field untouched. For more information, see\n[Unset a label field on a file](/workspace/drive/api/guides/unset-label). \n\nJava \n\n ModifyLabelsRequest modifyLabelsRequest =\n new ModifyLabelsRequest()\n .setLabelModifications(\n ImmutableList.of(\n new LabelModification()\n .setLabelId(\"\u003cvar translate=\"no\"\u003eLABEL_ID\u003c/var\u003e\")\n .setRemoveLabel(true)));\n\n ModifyLabelsResponse modifyLabelsResponse = driveService.files().modifyLabels(\"\u003cvar translate=\"no\"\u003eFILE_ID\u003c/var\u003e\", modifyLabelsRequest).execute();\n\nPython \n\n label_modification = {'labelId':'\u003cvar translate=\"no\"\u003eLABEL_ID\u003c/var\u003e', 'removeLabel': True]}\n\n modified_labels = drive_service.files().modifyLabels(fileId=\"\u003cvar translate=\"no\"\u003eFILE_ID\u003c/var\u003e\", body = {'labelModifications' : [label_modification]}).execute();\n\nNode.js \n\n /**\n * Remove a label on a Drive file\n * @return{obj} updated label data\n **/\n async function removeLabel() {\n // Get credentials and build service\n // TODO (developer) - Use appropriate auth mechanism for your app\n\n const {GoogleAuth} = require('google-auth-library');\n const {google} = require('googleapis');\n\n const auth = new GoogleAuth({scopes: 'https://www.googleapis.com/auth/drive'});\n const service = google.drive({version: 'v3', auth});\n const labelModification = {\n 'labelId': '\u003cvar translate=\"no\"\u003eLABEL_ID\u003c/var\u003e',\n 'removeLabel': True,\n };\n const labelModificationRequest = {\n 'labelModifications': [labelModification],\n };\n try {\n const updateResponse = await service.files.modifyLabels({\n fileId: '\u003cvar translate=\"no\"\u003eFILE_ID\u003c/var\u003e',\n resource: labelModificationRequest,\n });\n return updateResponse;\n } catch (err) {\n // TODO (developer) - Handle error\n throw err;\n }\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eLABEL_ID\u003c/var\u003e: The `labelId` of the label to modify. To locate the labels on a file, use the [`files.listLabels`](/workspace/drive/api/v2/reference/files/listLabels) method.\n- \u003cvar translate=\"no\"\u003eFILE_ID\u003c/var\u003e: The `fileId` of the file for which the labels are modified."]]