Class GroupsApp
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
গ্রুপ অ্যাপ এই ক্লাসটি Google গ্রুপের তথ্যে অ্যাক্সেস প্রদান করে। এটি একটি গ্রুপের ইমেল ঠিকানা, বা ব্যবহারকারী সরাসরি সদস্য যে গ্রুপের তালিকার মতো তথ্য অনুসন্ধান করতে ব্যবহার করা যেতে পারে।
এখানে একটি উদাহরণ যা দেখায় যে বর্তমান ব্যবহারকারী কত গোষ্ঠীর সদস্য:
const groups = GroupsApp.getGroups();
Logger.log(`You belong to ${groups.length} groups.`);
বৈশিষ্ট্য
সম্পত্তি | টাইপ | বর্ণনা |
---|
Role | Role | |
বিস্তারিত ডকুমেন্টেশন
get Group By Email(email)
নির্দিষ্ট ইমেল ঠিকানা থাকা গোষ্ঠী পুনরুদ্ধার করে। গোষ্ঠীটি বিদ্যমান না থাকলে বা আপনার কাছে এটি দেখার অনুমতি না থাকলে একটি ব্যতিক্রম নিক্ষেপ করে৷
এখানে একটি উদাহরণ রয়েছে যা একটি গোষ্ঠীকে তার ইমেল ঠিকানা দ্বারা পায় এবং বর্তমান ব্যবহারকারী সদস্য কিনা তা আউটপুট করে। চালানোর আগে, একটি আসল গ্রুপের ইমেলের সাথে নমুনা ইমেল ঠিকানাটি প্রতিস্থাপন করুন।
const group = GroupsApp.getGroupByEmail('example@googlegroups.com');
const currentUser = Session.getActiveUser();
if (group.hasUser(currentUser)) {
Logger.log('You are a member of this group.');
} else {
Logger.log('You are not a member of this group.');
}
পরামিতি
নাম | টাইপ | বর্ণনা |
---|
email | String | পুনরুদ্ধার করার জন্য গ্রুপের ইমেল ঠিকানা. |
প্রত্যাবর্তন
Group
- নির্দিষ্ট ইমেল ঠিকানা সহ গ্রুপ।
অনুমোদন
যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:
-
https://www.googleapis.com/auth/groups
get Groups()
আপনি যে সকল গোষ্ঠীর সরাসরি সদস্য (বা একটি মুলতুবি সদস্য) সেগুলি পুনরুদ্ধার করে৷ আপনি যদি কোনো গ্রুপে না থাকেন তবে এটি একটি খালি তালিকা। গোষ্ঠীটি বিদ্যমান না থাকলে বা আপনার কাছে এটি দেখার অনুমতি না থাকলে একটি ব্যতিক্রম নিক্ষেপ করে৷
ব্যবহারকারীর অন্তর্গত প্রতিটি গ্রুপের জন্য কীভাবে ইমেল ঠিকানা মুদ্রণ করবেন তার একটি উদাহরণ এখানে দেওয়া হল:
function showMyGroups() {
const groups = GroupsApp.getGroups();
let str = `You are in ${groups.length} groups: `;
for (let i = 0; i < groups.length; i++) {
const group = groups[i];
str = `${str + group.getEmail()} `;
}
Logger.log(str);
}
মনে রাখবেন যে আপনি যদি একটি গ্রুপ, B-এর সদস্য হন, যেটি নিজেই অন্য গ্রুপ, A-এর সদস্য, তাহলে আপনি
পরোক্ষভাবে গ্রুপ A-তে সদস্য হন। যদিও আপনি "অভিভাবক" গ্রুপ A-তে পাঠানো বার্তাগুলির অনুলিপি পান, আপনি আসলে সেই গ্রুপে সাবস্ক্রাইব করা হয় না।
আপনি যদি প্রত্যাবর্তিত গোষ্ঠীর একজন বিদ্যমান বা মুলতুবি সদস্য তা নির্ধারণ করতে আপনি Group.getRole(email)
ব্যবহার করতে পারেন।
প্রত্যাবর্তন
Group[]
— গ্রুপের তালিকা যার ব্যবহারকারী সরাসরি সদস্য।
অনুমোদন
যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:
-
https://www.googleapis.com/auth/groups
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-07-24 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-07-24 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eThe \u003ccode\u003eGroupsApp\u003c/code\u003e class in Apps Script allows you to access and manage Google Groups information, such as retrieving group details and membership status.\u003c/p\u003e\n"],["\u003cp\u003eYou can use \u003ccode\u003egetGroupByEmail()\u003c/code\u003e to retrieve a specific group by its email address and check if the current user is a member.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetGroups()\u003c/code\u003e retrieves all groups where the user is a direct or pending member, enabling actions like listing group email addresses.\u003c/p\u003e\n"],["\u003cp\u003eBoth methods require authorization with the \u003ccode\u003ehttps://www.googleapis.com/auth/groups\u003c/code\u003e scope for accessing Google Groups data.\u003c/p\u003e\n"]]],[],null,["# Class GroupsApp\n\nGroupsApp\n\nThis class provides access to Google Groups information. It can be used to query information such\nas a group's email address, or the list of groups in which the user is a direct member.\n\nHere's an example that shows how many groups the current user is a member of:\n\n```javascript\nconst groups = GroupsApp.getGroups();\nLogger.log(`You belong to ${groups.length} groups.`);\n``` \n\n### Properties\n\n| Property | Type | Description |\n|----------|--------------------------------------------|-------------|\n| `Role` | [Role](/apps-script/reference/groups/role) | |\n\n### Methods\n\n| Method | Return type | Brief description |\n|----------------------------------------------------|------------------------------------------------|----------------------------------------------------------------------------------|\n| [getGroupByEmail(email)](#getGroupByEmail(String)) | [Group](/apps-script/reference/groups/group) | Retrieves the group having the specified email address. |\n| [getGroups()](#getGroups()) | [Group[]](/apps-script/reference/groups/group) | Retrieves all the groups of which you are a direct member (or a pending member). |\n\nDetailed documentation\n----------------------\n\n### `get``Group``By``Email(email)`\n\nRetrieves the group having the specified email address. Throws an exception if the group does\nnot exist or if you do not have permission to see it.\n\nHere is an example that gets a group by its email address and outputs whether the current\nuser is a member. Before running, replace the sample email address with a real group's email.\n\n```javascript\nconst group = GroupsApp.getGroupByEmail('example@googlegroups.com');\nconst currentUser = Session.getActiveUser();\nif (group.hasUser(currentUser)) {\n Logger.log('You are a member of this group.');\n} else {\n Logger.log('You are not a member of this group.');\n}\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|---------|----------|---------------------------------------------|\n| `email` | `String` | The email address of the group to retrieve. |\n\n#### Return\n\n\n[Group](/apps-script/reference/groups/group) --- The group with the specified email address.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/groups`\n\n*** ** * ** ***\n\n### `get``Groups()`\n\nRetrieves all the groups of which you are a direct member (or a pending member). This is an\nempty list if you are not in any groups. Throws an exception if the group does not exist or if\nyou do not have permission to see it.\n\nHere's an example of how to print the email address for every group the user belongs to:\n\n```javascript\nfunction showMyGroups() {\n const groups = GroupsApp.getGroups();\n let str = `You are in ${groups.length} groups: `;\n for (let i = 0; i \u003c groups.length; i++) {\n const group = groups[i];\n str = `${str + group.getEmail()} `;\n }\n Logger.log(str);\n}\n```\nNote that if you are a member of a group, B, which is itself a member of another group, A, then you are *indirectly* subscribed to group A. Even though you receive copies of messages sent to the \"parent\" group A, you are not actually subscribed to that group.\n\nYou can use [Group.getRole(email)](/apps-script/reference/groups/group#getRole(String)) to determine if you are an existing or pending\nmember of the returned groups.\n\n#### Return\n\n\n[Group[]](/apps-script/reference/groups/group) --- The list of groups of which the user is a direct member.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/groups`"]]