संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
इस पेज पर, Google Drive की किसी फ़ाइल से लेबल हटाने का तरीका बताया गया है.
किसी फ़ाइल से फ़ाइल लेबल का मेटाडेटा हटाने के लिए, files.modifyLabels तरीके का इस्तेमाल करें. अनुरोध के मुख्य हिस्से में, किसी फ़ाइल पर लेबल के सेट में बदलाव करने के लिए ModifyLabelsRequest का एक इंस्टेंस शामिल होता है. अनुरोध में कई बदलाव शामिल हो सकते हैं, जिन्हें एक साथ लागू किया जाता है. इसका मतलब है कि अगर कोई बदलाव मान्य नहीं है, तो पूरा अपडेट लागू नहीं होगा. साथ ही, (संभावित रूप से निर्भर) कोई भी बदलाव लागू नहीं होगा.
ModifyLabelsRequest में LabelModification का एक इंस्टेंस शामिल है. यह फ़ाइल के लेबल में किया गया बदलाव है. इसमें FieldModification का कोई इंस्टेंस भी शामिल हो सकता है. यह लेबल के फ़ील्ड में किया गया बदलाव होता है. फ़ाइल से लेबल हटाने के लिए, FieldModification.removeLabel को True पर सेट करें.
अगर अनुरोध पूरा हो जाता है, तो जवाब के मुख्य हिस्से में, अनुरोध के ज़रिए जोड़े गए या अपडेट किए गए लेबल शामिल होते हैं. ये Label टाइप के modifiedLabels ऑब्जेक्ट में मौजूद होते हैं.
उदाहरण
यहां दिए गए कोड सैंपल में, labelId का इस्तेमाल करके लेबल से जुड़े सभी फ़ील्ड हटाने का तरीका बताया गया है. इसके लिए, fileId का इस्तेमाल किया जाता है. उदाहरण के लिए, अगर किसी लेबल में टेक्स्ट और उपयोगकर्ता फ़ील्ड, दोनों शामिल हैं, तो लेबल हटाने पर, उससे जुड़े टेक्स्ट और उपयोगकर्ता फ़ील्ड, दोनों मिट जाते हैं. वहीं, टेक्स्ट फ़ील्ड को अनसेट करने से, यह लेबल से हट जाता है. हालांकि, इससे उपयोगकर्ता फ़ील्ड पर कोई असर नहीं पड़ता. ज़्यादा जानकारी के लिए, किसी फ़ाइल से लेबल फ़ील्ड हटाना लेख पढ़ें.
/*** Remove a label on a Drive file* @return{obj} updated label data**/asyncfunctionremoveLabel(){// Get credentials and build service// TODO (developer) - Use appropriate auth mechanism for your appconst{GoogleAuth}=require('google-auth-library');const{google}=require('googleapis');constauth=newGoogleAuth({scopes:'https://www.googleapis.com/auth/drive'});constservice=google.drive({version:'v3',auth});constlabelModification={'labelId':'LABEL_ID','removeLabel':True,};constlabelModificationRequest={'labelModifications':[labelModification],};try{constupdateResponse=awaitservice.files.modifyLabels({fileId:'FILE_ID',resource:labelModificationRequest,});returnupdateResponse;}catch(err){// TODO (developer) - Handle errorthrowerr;}
इनकी जगह ये डालें:
LABEL_ID: बदलाव करने के लिए लेबल का labelId. किसी फ़ाइल पर मौजूद लेबल ढूंढने के लिए, files.listLabels तरीके का इस्तेमाल करें.
FILE_ID: यह उस फ़ाइल का fileId है जिसके लेबल में बदलाव किया गया है.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 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."]]