Dịch vụ trình quản lý giấy phép dành cho doanh nghiệp của SDK dành cho quản trị viên
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Dịch vụ Enterprise License Manager của Admin SDK cho phép bạn sử dụng Enterprise License Manager API của Admin SDK trong Apps Script. API này cho phép quản trị viên miền chỉ định, cập nhật, truy xuất và xoá giấy phép người dùng.
Tài liệu tham khảo
Để biết thông tin chi tiết về dịch vụ này, hãy xem tài liệu tham khảo cho API Trình quản lý giấy phép doanh nghiệp của Admin SDK. Giống như tất cả các dịch vụ nâng cao trong Apps Script, dịch vụ Trình quản lý giấy phép doanh nghiệp của Admin SDK cũng sử dụng các đối tượng, phương thức và tham số giống như API công khai. Để biết thêm thông tin, hãy xem bài viết Cách xác định chữ ký phương thức.
Lấy danh sách các lượt chỉ định giấy phép cho miền
Mẫu này ghi lại các lượt chỉ định giấy phép, bao gồm cả mã sản phẩm và mã SKU, cho người dùng trong miền.
Lưu ý việc sử dụng mã thông báo trang để truy cập vào danh sách kết quả đầy đủ.
/** * 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);}}
Chèn thông tin cấp giấy phép cho người dùng
Mẫu này minh hoạ cách chèn một lượt chỉ định giấy phép cho người dùng, cho một tổ hợp mã nhận dạng sản phẩm và mã nhận dạng sku nhất định.
/** * 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('Failed with an error %s ',e.message);}}
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-08-31 UTC."],[[["\u003cp\u003eThe Admin SDK Enterprise License Manager service enables domain admins to manage user licenses within Apps Script using the Admin SDK Enterprise License Manager API.\u003c/p\u003e\n"],["\u003cp\u003eIt allows for assigning, updating, retrieving, and deleting user licenses for various products.\u003c/p\u003e\n"],["\u003cp\u003eThis is an advanced service that requires enabling before use and utilizes the same structure as the public API.\u003c/p\u003e\n"],["\u003cp\u003eProvided sample code demonstrates how to retrieve and assign licenses using the API.\u003c/p\u003e\n"]]],[],null,[]]