সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
এই পৃষ্ঠাটি বর্ণনা করে কিভাবে একটি একক Google ড্রাইভ ফাইলে একটি লেবেল Field আনসেট করতে হয়৷
একটি ফাইল লেবেল আনসেট করে একটি ফাইল থেকে মেটাডেটা সরাতে, files.modifyLabels পদ্ধতি ব্যবহার করুন। অনুরোধের মূল অংশে একটি ফাইলের লেবেলগুলির সেট পরিবর্তন করার জন্য ModifyLabelsRequest এর একটি উদাহরণ রয়েছে৷ অনুরোধে কিছু পরিবর্তন থাকতে পারে যা পারমাণবিকভাবে প্রয়োগ করা হয়। অর্থাৎ, যদি কোনো পরিবর্তন বৈধ না হয়, তাহলে সম্পূর্ণ আপডেটটি ব্যর্থ হয় এবং (সম্ভাব্যভাবে নির্ভরশীল) পরিবর্তনগুলির কোনোটিই প্রয়োগ করা হয় না।
ModifyLabelsRequest এ LabelModification এর একটি উদাহরণ রয়েছে যা একটি ফাইলের লেবেলে একটি পরিবর্তন। এটিতে FieldModification এর একটি উদাহরণও থাকতে পারে যা একটি লেবেলের ক্ষেত্রের একটি পরিবর্তন। ক্ষেত্রের মানগুলি আনসেট করতে, FieldModification.unsetValuesTrue এ সেট করুন।
সফল হলে, প্রতিক্রিয়া বডিতে অনুরোধ দ্বারা যোগ করা বা আপডেট করা লেবেলগুলি থাকে৷ এগুলি Label টাইপের একটি modifiedLabels লেবেল অবজেক্টের মধ্যে বিদ্যমান।
উদাহরণ
নিম্নলিখিত কোড নমুনা দেখায় কিভাবে fieldId এবং labelId ব্যবহার করে সংশ্লিষ্ট fileId ফিল্ডের মান আনসেট করতে হয়। উদাহরণস্বরূপ, যদি একটি লেবেলে পাঠ্য এবং ব্যবহারকারী ক্ষেত্র উভয়ই থাকে তবে পাঠ্য ক্ষেত্রটি আনসেট করা এটি লেবেল থেকে সরিয়ে দেয় তবে ব্যবহারকারীর ক্ষেত্রটিকে স্পর্শ না করে। যেখানে একটি লেবেল অপসারণ করা হলে লেবেলের সাথে যুক্ত পাঠ্য এবং ব্যবহারকারী ক্ষেত্র উভয়ই মুছে যায়। আরও তথ্যের জন্য, একটি ফাইল থেকে একটি লেবেল সরান দেখুন।
/*** Unset a label with a field on a Drive file* @return{obj} updated label data**/asyncfunctionunsetLabelField(){// 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});constfieldModification={'fieldId':'FIELD_ID','unsetValues':True,};constlabelModification={'labelId':'LABEL_ID','fieldModifications':[fieldModification],};constlabelModificationRequest={'labelModifications':[labelModification],};try{constupdateResponse=awaitservice.files.modifyLabels({fileId:'FILE_ID',resource:labelModificationRequest,});returnupdateResponse;}catch(err){// TODO (developer) - Handle errorthrowerr;}}
নিম্নলিখিতগুলি প্রতিস্থাপন করুন:
FIELD_ID : যে ক্ষেত্রের fieldId পরিবর্তন করতে হবে। fieldId সনাক্ত করতে, Google ড্রাইভ লেবেল API ব্যবহার করে লেবেলটি পুনরুদ্ধার করুন।
LABEL_ID : লেবেলের labelId পরিবর্তন করার জন্য।
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-08-29 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["# Unset a label field on a file\n\nThis page describes how to unset a label\n[`Field`](/workspace/drive/labels/reference/rest/v2/labels#field) on a single\nGoogle Drive file.\n\nTo remove metadata from a file by unsetting a file label, 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 unset the values for the field,\nset `FieldModification.unsetValues` 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-------\n\nThe following code sample shows how to use the `fieldId` and `labelId` to unset\nthe field values on the associated `fileId`. For example, if a label contains\nboth text and user fields, unsetting the text field removes it from the label\nbut leaves the user field untouched. Whereas removing a label deletes *both* the\ntext and user fields associated with the label. For more information, see\n[Remove a label from a file](/workspace/drive/api/guides/remove-label). \n\n### Java\n\n LabelFieldModification fieldModification =\n new LabelFieldModification().setFieldId(\"\u003cvar translate=\"no\"\u003eFIELD_ID\u003c/var\u003e\").setUnsetValues(true);\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 .setFieldModifications(ImmutableList.of(fieldModification))));\n\n ModifyLabelsResponse modifyLabelsResponse = driveService.files().modifyLabels(\"\u003cvar translate=\"no\"\u003eFILE_ID\u003c/var\u003e\", modifyLabelsRequest).execute();\n\n### Python\n\n field_modification = {'fieldId':'\u003cvar translate=\"no\"\u003eFIELD_ID\u003c/var\u003e','unsetValues':True}\n label_modification = {'labelId':'\u003cvar translate=\"no\"\u003eLABEL_ID\u003c/var\u003e', 'fieldModifications':[field_modification]}\n\n modified_labels = drive_service.files().modifyLabels(fileId=\"\u003cvar translate=\"no\"\u003eFILE_ID\u003c/var\u003e\", body = {'labelModifications' : [label_modification]}).execute();\n\n### Node.js\n\n /**\n * Unset a label with a field on a Drive file\n * @return{obj} updated label data\n **/\n async function unsetLabelField() {\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 fieldModification = {\n 'fieldId': '\u003cvar translate=\"no\"\u003eFIELD_ID\u003c/var\u003e',\n 'unsetValues': True,\n };\n const labelModification = {\n 'labelId': '\u003cvar translate=\"no\"\u003eLABEL_ID\u003c/var\u003e',\n 'fieldModifications': [fieldModification],\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 }\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eFIELD_ID\u003c/var\u003e: The `fieldId` of the field to modify. To locate the `fieldId`, retrieve the label using the [Google Drive Labels API](/workspace/drive/labels/guides/search-label).\n- \u003cvar translate=\"no\"\u003eLABEL_ID\u003c/var\u003e: The `labelId` of the label to modify.\n- \u003cvar translate=\"no\"\u003eFILE_ID\u003c/var\u003e: The `fileId` of the file for which the labels are modified."]]