Admin SDK Enterprise लाइसेंस मैनेजर सेवा की मदद से, Apps Script में Admin SDK Enterprise लाइसेंस मैनेजर एपीआई का इस्तेमाल किया जा सकता है. इस एपीआई की मदद से, डोमेन एडमिन उपयोगकर्ताओं के लाइसेंस असाइन कर सकते हैं, अपडेट कर सकते हैं, वापस पा सकते हैं, और मिटा सकते हैं.
रेफ़रंस
इस सेवा के बारे में ज़्यादा जानकारी के लिए, Admin SDK Enterprise License Manager API का रेफ़रंस दस्तावेज़ देखें. Apps Script की सभी बेहतर सेवाओं की तरह, Admin SDK Enterprise License Manager सेवा भी सार्वजनिक एपीआई के जैसे ही ऑब्जेक्ट, तरीकों, और पैरामीटर का इस्तेमाल करती है. ज़्यादा जानकारी के लिए, मेथड सिग्नेचर तय करने का तरीका लेख पढ़ें.
यहां दिए गए सैंपल कोड में, एपीआई के वर्शन 1 का इस्तेमाल किया गया है.
डोमेन के लिए लाइसेंस असाइनमेंट की सूची पाना
यह सैंपल, डोमेन में मौजूद उपयोगकर्ताओं के लिए लाइसेंस असाइनमेंट को लॉग करता है. इसमें प्रॉडक्ट आईडी और SKU आईडी भी शामिल है.
नतीजों की पूरी सूची ऐक्सेस करने के लिए, पेज टोकन के इस्तेमाल पर ध्यान दें.
/** * Logs the license assignments, including the product ID and the sku ID, for * the users in the domain. Notice the use of page tokens to access the full * list of results. */functiongetLicenseAssignments(){constproductId='Google-Apps';constcustomerId='example.com';letassignments=[];letpageToken=null;do{constresponse=AdminLicenseManager.LicenseAssignments.listForProduct(productId,customerId,{maxResults:500,pageToken:pageToken});assignments=assignments.concat(response.items);pageToken=response.nextPageToken;}while(pageToken);// Print the productId and skuIdfor(constassignmentofassignments){console.log('userId:%s,productId:%s,skuId:%s',assignment.userId,assignment.productId,assignment.skuId);}}
किसी उपयोगकर्ता के लिए लाइसेंस असाइनमेंट डालना
इस सैंपल में, किसी उपयोगकर्ता के लिए लाइसेंस असाइन करने का तरीका बताया गया है.
/** * Insert a license assignment for a user, for a given product ID and sku ID * combination. * For more details follow the link * https://developers.google.com/admin-sdk/licensing/reference/rest/v1/licenseAssignments/insert */functioninsertLicenseAssignment(){constproductId='Google-Apps';constskuId='Google-Vault';constuserId='marty@hoverboard.net';try{constresults=AdminLicenseManager.LicenseAssignments.insert({userId:userId},productId,skuId);console.log(results);}catch(e){// TODO (developer) - Handle exception.console.log('Failedwithanerror%s',e.message);}}
[[["समझने में आसान है","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"]],["आखिरी बार 2024-12-21 (UTC) को अपडेट किया गया."],[[["The Admin SDK Enterprise License Manager service enables domain admins to manage user licenses within Apps Script using the Admin SDK Enterprise License Manager API."],["It allows for assigning, updating, retrieving, and deleting user licenses for various products."],["This is an advanced service that requires enabling before use and utilizes the same structure as the public API."],["Provided sample code demonstrates how to retrieve and assign licenses using the API."]]],[]]