CINXE.COM
List a user's direct memberships - Microsoft Graph v1.0 | Microsoft Learn
<!DOCTYPE html><html class="hasSidebar hasPageActions hasBreadcrumb conceptual has-default-focus theme-light" lang="en-us" dir="ltr" data-authenticated="false" data-auth-status-determined="false" data-target="docs" x-ms-format-detection="none"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta property="og:title" content="List a user's direct memberships - Microsoft Graph v1.0" /> <meta property="og:type" content="website" /> <meta property="og:url" content="https://learn.microsoft.com/en-us/graph/api/user-list-memberof?view=graph-rest-1.0" /><meta property="og:description" content="Get groups, directory roles, and administrative units that the user is a direct member of. This operation isn't transitive." /><meta property="og:image" content="https://learn.microsoft.com/en-us/media/open-graph-image.png" /> <meta property="og:image:alt" content="Microsoft Learn" /> <meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:site" content="@MicrosoftLearn" /> <meta name="color-scheme" content="light dark"><meta name="author" content="yuhko-msft" /> <meta name="breadcrumb_path" content="/graph/breadcrumb/toc.json" /> <meta name="default_moniker" content="graph-rest-1.0" /> <meta name="depot_name" content="MSDN.microsoft-graph-ref" /> <meta name="description" content="Get groups, directory roles, and administrative units that the user is a direct member of. This operation isn't transitive." /> <meta name="doc_type" content="apiPageType" /> <meta name="document_id" content="9188ffdb-b7af-597d-9e0a-d92e75ff8e7d" /> <meta name="document_version_independent_id" content="c4427823-3f37-dc4b-ac1e-b750cb633e23" /> <meta name="feedback_help_link_type" content="" /> <meta name="feedback_help_link_url" content="" /> <meta name="feedback_product_url" content="https://developer.microsoft.com/graph/support" /> <meta name="feedback_system" content="Standard" /> <meta name="git_commit_id" content="698573faf7fdb90e7aa83946e3d0677d4130394a" /> <meta name="gitcommit" content="https://github.com/microsoftgraph/microsoft-graph-docs/blob/698573faf7fdb90e7aa83946e3d0677d4130394a/api-reference/v1.0/api/user-list-memberof.md" /> <meta name="interactive_type" content="msgraph" /> <meta name="locale" content="en-us" /> <meta name="monikerRange" content="graph-rest-1.0" /> <meta name="monikers" content="graph-rest-1.0" /> <meta name="ms.author" content="MSGraphDocsVteam" /> <meta name="ms.date" content="10/22/2024" /> <meta name="ms.localizationpriority" content="high" /> <meta name="ms.reviewer" content="mbhargav, khotzteam, aadgroupssg" /> <meta name="ms.service" content="microsoft-graph" /> <meta name="ms.subservice" content="entra-users" /> <meta name="ms.suite" content="microsoft-graph" /> <meta name="ms.topic" content="reference" /> <meta name="original_content_git_url" content="https://github.com/microsoftgraph/microsoft-graph-docs/blob/live/api-reference/v1.0/api/user-list-memberof.md" /> <meta name="page_type" content="conceptual" /> <meta name="recommendations" content="false" /> <meta name="schema" content="Conceptual" /> <meta name="site_name" content="Docs" /> <meta name="toc_preview" content="true" /> <meta name="toc_rel" content="toc.json" /> <meta name="uhfHeaderId" content="MSDocsHeader-MSGraph" /> <meta name="updated_at" content="2024-11-21 04:12 AM" /> <meta name="word_count" content="1619" /> <meta name="persistent_id" content="0cccb1b4-8a20-aa25-a0f5-54803752d6f9" /> <meta name="cmProducts" content="https://authoring-docs-microsoft.poolparty.biz/devrel/5fc61396-d075-4560-aece-fdbda73d243f" data-source="generated" /> <meta name="spProducts" content="https://authoring-docs-microsoft.poolparty.biz/devrel/ad9437c1-8cda-4537-ad69-b4b263652e13" data-source="generated" /> <meta name="2PlusCloud" content="Azure" data-source="generated" /> <meta name="2PlusCloud" content="M365" data-source="generated" /> <meta name="scope" content="graph" /><meta name="github_feedback_content_git_url" content="https://github.com/microsoftgraph/microsoft-graph-docs-contrib/blob/main/api-reference/v1.0/api/user-list-memberof.md" /><link href="https://learn.microsoft.com/en-us/graph/api/user-list-memberof?view=graph-rest-1.0" rel="canonical"><title>List a user's direct memberships - Microsoft Graph v1.0 | Microsoft Learn</title><link rel="stylesheet" href="/static/assets/0.4.028726178/styles/site-ltr.css"> <script id="msdocs-script"> var msDocs = {environment: { supportLevel: 'production', accessLevel: 'online', reviewFeatures: false, systemContent: true, azurePortalHostname: 'portal.azure.com', legacyHosting: false, siteName: 'learn', },data: { timeOrigin: Date.now(), contentLocale: 'en-us', contentDir: 'ltr', userLocale: 'en-us', userDir: 'ltr', pageTemplate: 'Conceptual', brand: '', context: {}, hasBinaryRating: true, feedbackHelpLinkType:'', feedbackHelpLinkUrl:'', standardFeedback: true, showFeedbackReport: false, enableTutorialFeedback: false, feedbackSystem: 'Standard', feedbackGitHubRepo: 'microsoftgraph/microsoft-graph-docs-contrib', feedbackProductUrl: 'https://developer.microsoft.com/graph/support',extendBreadcrumb: false,isEditDisplayable: true, hideViewSource: false, hasPageActions: true, hasPrintButton: true, hasBookmark: true, hasShare: true, isPermissioned: false, isPrivateUnauthorized: false,hasRecommendations: true,contributors: [{ name: "yuhko-msft", url: "https://github.com/yuhko-msft" },{ name: "Saisang", url: "https://github.com/Saisang" },{ name: "FaithOmbongi", url: "https://github.com/FaithOmbongi" },{ name: "Lauragra", url: "https://github.com/Lauragra" },{ name: "mukeshk-ms", url: "https://github.com/mukeshk-ms" },{ name: "MichaelNorman", url: "https://github.com/MichaelNorman" },{ name: "psignoret", url: "https://github.com/psignoret" },{ name: "jasonjoh", url: "https://github.com/jasonjoh" },{ name: "SteveWilkins1123", url: "https://github.com/SteveWilkins1123" },{ name: "psaffaie", url: "https://github.com/psaffaie" },{ name: "Jordanndahl", url: "https://github.com/Jordanndahl" },{ name: "ramical", url: "https://github.com/ramical" },{ name: "JarbasHorst", url: "https://github.com/JarbasHorst" },{ name: "davidmu1", url: "https://github.com/davidmu1" },{ name: "andrueastman", url: "https://github.com/andrueastman" },{ name: "DCtheGeek", url: "https://github.com/DCtheGeek" },{ name: "jthake", url: "https://github.com/jthake" },{ name: "rwike77", url: "https://github.com/rwike77" },{ name: "millicentachieng", url: "https://github.com/millicentachieng" },{ name: "tony-xia", url: "https://github.com/tony-xia" },{ name: "OfficeGSX", url: "https://github.com/OfficeGSX" }],}, functions:{} }; </script><script src="https://wcpstatic.microsoft.com/mscc/lib/v2/wcp-consent.js"></script> <script src="https://js.monitor.azure.com/scripts/c/ms.jsll-4.min.js"></script><script src="/static/assets/0.4.028726178/global/deprecation.js"></script><script src="/static/assets/0.4.028726178/scripts/en-us/index-docs.js"></script></head> <body lang="en-us" dir="ltr"> <div class="header-holder has-default-focus"> <a href="#main" style="z-index: 1070" class="outline-color-text visually-hidden-until-focused position-fixed inner-focus focus-visible top-0 left-0 right-0 padding-xs text-align-center has-body-background" tabindex="1">Skip to main content</a><div hidden id="cookie-consent-holder" data-test-id="cookie-consent-container"></div> <div id="unsupported-browser" style=" background-color: white; color: black; padding: 16px; border-bottom: 1px solid grey;" hidden > <div style="max-width: 800px; margin: 0 auto;"> <p style="font-size: 24px">This browser is no longer supported.</p> <p style="font-size: 16px; margin-top: 16px;">Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.</p> <div style="margin-top: 12px;"> <a href="https://go.microsoft.com/fwlink/p/?LinkID=2092881 " style=" background-color: #0078d4; border: 1px solid #0078d4; color: white; padding: 6px 12px; border-radius: 2px; display: inline-block; ">Download Microsoft Edge</a> <a href="https://learn.microsoft.com/en-us/lifecycle/faq/internet-explorer-microsoft-edge" style=" background-color: white; padding: 6px 12px; border: 1px solid #505050; color: #171717; border-radius: 2px; display: inline-block; ">More info about Internet Explorer and Microsoft Edge</a> </div> </div> </div> <!-- liquid-tag banners global --> <!-- site header --> <header id="ms--site-header" data-test-id="site-header-wrapper" role="banner" itemscope="itemscope" itemtype="http://schema.org/Organization"> <div id="ms--mobile-nav" class="site-header display-none-tablet padding-inline-none gap-none" data-bi-name="mobile-header" data-test-id="mobile-header"></div> <div id="ms--primary-nav" class="site-header display-none display-flex-tablet" data-bi-name="L1-header" data-test-id="primary-header"></div> <div id="ms--secondary-nav" class="site-header display-none display-flex-tablet" data-bi-name="L2-header" data-test-id="secondary-header"></div> </header><div id="content-header" class="content-header uhf-container has-padding has-default-focus border-bottom-none" data-bi-name="content-header"> <div class="content-header-controls margin-xxs margin-inline-sm-tablet"> <button type="button" class="contents-button button button-sm margin-right-xxs" data-bi-name="contents-expand" aria-haspopup="true" data-contents-button> <span class="icon"><span class="docon docon-menu" aria-hidden="true"></span></span> <span class="contents-expand-title">Table of contents</span> </button> <button type="button" class="ap-collapse-behavior ap-expanded button button-sm" data-bi-name="ap-collapse" aria-controls="action-panel"> <span class="icon"><span class="docon docon-exit-mode" aria-hidden="true"></span></span> <span>Exit focus mode</span> </button> </div> </div><div id="disclaimer-holder" class="has-overflow-hidden has-default-focus"> <!-- liquid-tag banners sectional --> </div> </div> <div class="mainContainer uhf-container has-default-focus" data-bi-name="body"> <div class="columns has-large-gaps is-gapless-mobile "><div id="left-container" class="left-container is-hidden-mobile column is-one-third-tablet is-one-quarter-desktop"> <nav id="affixed-left-container" class="margin-top-sm-tablet position-sticky display-flex flex-direction-column" aria-label="Primary"></nav> </div><!-- .primary-holder --> <section class="primary-holder column is-two-thirds-tablet is-three-quarters-desktop"> <!--div.columns --> <div class="columns is-gapless-mobile has-large-gaps "><div id="main-column" class="column is-full is-8-desktop"> <main id="main" class="" role="main" data-bi-name="content" lang="en-us" dir="ltr"><!-- article-header --> <div id="article-header" class="background-color-body margin-top-sm-tablet margin-bottom-xs display-none-print"> <div class="display-flex align-items-center "><details id="article-header-breadcrumbs-overflow-popover" class="popover" data-for="article-header-breadcrumbs"> <summary class="button button-clear button-primary button-sm inner-focus" aria-label="All breadcrumbs"> <span class="icon"> <span class="docon docon-more"></span> </span> </summary> <div id="article-header-breadcrumbs-overflow" class="popover-content padding-none"> </div> </details> <bread-crumbs id="article-header-breadcrumbs" data-test-id="article-header-breadcrumbs" class="overflow-hidden flex-grow-1 margin-right-sm margin-right-md-tablet margin-right-lg-desktop margin-left-negative-xxs padding-left-xxs"></bread-crumbs><div id="article-header-page-actions" class="opacity-none margin-left-auto display-flex flex-wrap-no-wrap align-items-stretch"><a id="lang-link-tablet" class="button button-primary button-clear button-sm display-none display-inline-flex-tablet" title="Read in English" data-bi-name="language-toggle" data-read-in-link hidden> <span class="icon margin-none" aria-hidden="true" data-read-in-link-icon> <span class="docon docon-locale-globe"></span> </span> <span class="is-visually-hidden" data-read-in-link-text>Read in English</span> </a><button type="button" class="collection button button-clear button-sm button-primary display-none display-inline-flex-tablet" data-list-type="collection" data-bi-name="collection" title="Add to collection"> <span class="icon margin-none" aria-hidden="true"> <span class="docon docon-circle-addition"></span> </span> <span class="collection-status is-visually-hidden">Save</span> </button><a data-contenteditbtn class="button button-clear button-sm text-decoration-none button-primary display-none display-inline-flex-tablet" aria-label="Edit" title="Edit This Document" data-bi-name="edit" href="https://github.com/microsoftgraph/microsoft-graph-docs-contrib/blob/main/api-reference/v1.0/api/user-list-memberof.md" data-original_content_git_url="https://github.com/microsoftgraph/microsoft-graph-docs/blob/live/api-reference/v1.0/api/user-list-memberof.md" data-original_content_git_url_template="{repo}/blob/{branch}/api-reference/v1.0/api/user-list-memberof.md" data-pr_repo="" data-pr_branch=""> <span class="icon margin-none" aria-hidden="true"> <span class="docon docon-edit-outline"></span> </span> </a> <details class="popover popover-right" id="article-header-page-actions-overflow"> <summary class="justify-content-flex-start button button-clear button-sm button-primary" aria-label="More actions" title="More actions"> <span class="icon" aria-hidden="true"> <span class="docon docon-more-vertical"></span> </span> </summary> <div class="popover-content padding-xs"><button data-page-action-item="overflow-mobile" type="button" class="justify-content-flex-start button-block button-sm has-inner-focus button button-clear display-none-tablet" data-bi-name="contents-expand" data-contents-button data-popover-close> <span class="icon"> <span class="docon docon-editor-list-bullet" aria-hidden="true"></span> </span><span class="contents-expand-title">Table of contents</span></button><a id="lang-link-overflow" class="justify-content-flex-start button-sm has-inner-focus button button-clear button-block display-none-tablet" title="Read in English" data-bi-name="language-toggle" data-page-action-item="overflow-mobile" data-check-hidden="true" data-read-in-link hidden > <span class="icon" aria-hidden="true" data-read-in-link-icon> <span class="docon docon-locale-globe"></span> </span> <span data-read-in-link-text>Read in English</span> </a><button type="button" class="collection justify-content-flex-start button button-clear button-sm has-inner-focus button-block display-none-tablet" data-list-type="collection" data-bi-name="collection" title="Save" data-page-action-item="overflow-mobile" data-check-hidden="true" data-popover-close> <span class="icon" aria-hidden="true"> <span class="docon docon-circle-addition"></span> </span> <span class="collection-status">Save</span> </button> <button type="button" class="collection justify-content-flex-start button button-clear button-sm has-inner-focus button-block display-none-tablet" data-list-type="plan" data-bi-name="plan" title="Add to Plan" data-page-action-item="overflow-mobile" data-check-hidden="true" data-popover-close hidden> <span class="icon" aria-hidden="true"> <span class="docon docon-circle-addition"></span> </span> <span class="plan-status">Add to Plan</span> </button><a data-contenteditbtn class="button button-clear button-block button-sm has-inner-focus justify-content-flex-start text-decoration-none display-none-tablet" aria-label="Edit" title="Edit This Document" data-bi-name="edit" href="https://github.com/microsoftgraph/microsoft-graph-docs-contrib/blob/main/api-reference/v1.0/api/user-list-memberof.md" data-original_content_git_url="https://github.com/microsoftgraph/microsoft-graph-docs/blob/live/api-reference/v1.0/api/user-list-memberof.md" data-original_content_git_url_template="{repo}/blob/{branch}/api-reference/v1.0/api/user-list-memberof.md" data-pr_repo="" data-pr_branch=""> <span class="icon" aria-hidden="true"> <span class="docon docon-edit-outline"></span> </span> <span>Edit</span> </a><div aria-hidden="true" class="margin-none" data-page-action-item="overflow-all"></div> <hr class="display-none-tablet margin-bottom-xxs margin-top-xxs" /> <h4 class="font-size-sm padding-left-xxs">Share via</h4> <a class="button button-clear button-sm button-block has-inner-focus text-decoration-none justify-content-flex-start share-facebook" data-bi-name="facebook" data-page-action-item="overflow-all"> <span class="icon" aria-hidden="true"> <span class="docon docon-facebook-share font-size-md color-primary"></span> </span> <span class="margin-left-xxs">Facebook</span> </a> <a class="button button-clear button-sm has-inner-focus button-block text-decoration-none justify-content-flex-start share-twitter" data-bi-name="twitter" data-page-action-item="overflow-all"> <span class="icon" aria-hidden="true"> <span class="docon docon-xlogo-share font-size-xxs"></span> </span> <span class="margin-left-xxs">x.com</span> </a> <a class="button button-clear button-sm has-inner-focus button-block text-decoration-none justify-content-flex-start share-linkedin" data-bi-name="linkedin" data-page-action-item="overflow-all"> <span class="icon" aria-hidden="true"> <span class="docon docon-linked-in-logo font-size-sm color-primary"></span> </span> <span class="margin-left-xxs">LinkedIn</span> </a> <a class="button button-clear button-sm button-block has-inner-focus text-decoration-none justify-content-flex-start margin-bottom-xxs share-email" data-bi-name="email" data-page-action-item="overflow-all"> <span class="icon" aria-hidden="true"> <span class="docon docon-mail-message font-size-sm color-primary"></span> </span> <span class="margin-left-xxs">Email</span> </a><hr /> <button class="button button-block button-clear button-sm justify-content-flex-start has-inner-focus margin-top-xxs" title="Print" type="button" aria-label="Print" data-bi-name="print" data-page-action-item="overflow-all" data-popover-close data-print-page data-check-hidden="true"> <span class="icon" aria-hidden="true"> <span class="docon docon-print font-size-sm color-primary"></span> </span> <span class="margin-left-xxs">Print</span> </button> </div> </details> </div></div> </div> <!-- end article-header --><div> <button type="button" class="border contents-button button button-clear button-sm is-hidden-tablet has-inner-focus" data-bi-name="contents-expand" data-contents-button hidden> <span class="icon"> <span class="docon docon-editor-list-bullet" aria-hidden="true"></span> </span><span class="contents-expand-title">Table of contents</span></button> </div><!-- end mobile-contents button --> <div class="content "><h1 id="list-a-users-direct-memberships">List a user's direct memberships</h1><div class="display-flex justify-content-space-between align-items-center flex-wrap-wrap page-metadata-container"> <div class="margin-right-xxs"> <ul class="metadata page-metadata" data-bi-name="page info" lang="en-us" dir="ltr"><li>Article</li><li class="visibility-hidden-visual-diff"><time class="is-invisible" data-article-date aria-label="Article review date" datetime="2024-10-22T08:00:00Z" data-article-date-source="calculated">10/22/2024</time> </li><li class="contributors-holder display-none-print"> <button aria-label="View all contributors" class="contributors-button link-button" data-bi-name="contributors" title="View all contributors">21 contributors</button> </li></ul> </div> <div id="user-feedback" class="margin-block-xxs display-none-print" data-hide-on-archived> <button id="user-feedback-button" data-test-id="conceptual-feedback-button" class="button button-sm button-clear button-primary" type="button" data-bi-name="user-feedback-button" data-user-feedback-button > <span class="icon" aria-hidden="true"> <span class="docon docon-like"></span> </span> <span>Feedback</span> </button> </div></div><nav id="center-doc-outline" class="doc-outline is-hidden-desktop display-none-print margin-bottom-sm" data-bi-name="intopic toc" aria-label="In this article"> <h2 id="ms--in-this-article" class="title is-6 margin-block-xs">In this article</h2> </nav><!-- <content> --><p>Namespace: microsoft.graph</p> <p>Get <a href="resources/group?view=graph-rest-1.0" data-linktype="relative-path">groups</a>, <a href="resources/directoryrole?view=graph-rest-1.0" data-linktype="relative-path">directory roles</a>, and <a href="resources/administrativeunit?view=graph-rest-1.0" data-linktype="relative-path">administrative units</a> that the user is a direct member of. This operation isn't transitive. To retrieve groups, directory roles, and administrative units that the user is a member through transitive membership, use the <a href="user-list-transitivememberof?view=graph-rest-1.0" data-linktype="relative-path">List user transitive memberOf</a> API.</p> <!-- markdownlint-disable MD041--> <p>This API is available in the following <a href="/en-us/graph/deployments" data-linktype="absolute-path">national cloud deployments</a>.</p> <table> <thead> <tr> <th>Global service</th> <th>US Government L4</th> <th>US Government L5 (DOD)</th> <th>China operated by 21Vianet</th> </tr> </thead> <tbody> <tr> <td>✅</td> <td>✅</td> <td>✅</td> <td>✅</td> </tr> </tbody> </table> <h2 id="permissions">Permissions</h2> <p>Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions <a href="/en-us/graph/permissions-overview#best-practices-for-using-microsoft-graph-permissions" data-linktype="absolute-path">only if your app requires it</a>. For details about delegated and application permissions, see <a href="/en-us/graph/permissions-overview#permission-types" data-linktype="absolute-path">Permission types</a>. To learn more about these permissions, see the <a href="/en-us/graph/permissions-reference" data-linktype="absolute-path">permissions reference</a>.</p> <h3 id="permissions-for-the-signed-in-users-direct-memberships">Permissions for the signed-in user's direct memberships</h3> <!-- { "blockType": "ignored" } // Note: Removing this line will result in the permissions autogeneration tool overwriting the table. --> <table> <thead> <tr> <th style="text-align: left;">Permission type</th> <th style="text-align: left;">Least privileged permissions</th> <th style="text-align: left;">Higher privileged permissions</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">Delegated (work or school account)</td> <td style="text-align: left;">User.Read</td> <td style="text-align: left;">Directory.Read.All, Directory.ReadWrite.All, GroupMember.Read.All</td> </tr> <tr> <td style="text-align: left;">Delegated (personal Microsoft account)</td> <td style="text-align: left;">Not supported.</td> <td style="text-align: left;">Not supported.</td> </tr> <tr> <td style="text-align: left;">Application</td> <td style="text-align: left;">Not supported.</td> <td style="text-align: left;">Not supported.</td> </tr> </tbody> </table> <h3 id="permissions-for-another-users-direct-memberships">Permissions for another user's direct memberships</h3> <!-- { "blockType": "ignored" } // Note: Removing this line will result in the permissions autogeneration tool overwriting the table. --> <table> <thead> <tr> <th style="text-align: left;">Permission type</th> <th style="text-align: left;">Least privileged permissions</th> <th style="text-align: left;">Higher privileged permissions</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">Delegated (work or school account)</td> <td style="text-align: left;">User.Read.All</td> <td style="text-align: left;">Directory.Read.All, Directory.ReadWrite.All, GroupMember.Read.All</td> </tr> <tr> <td style="text-align: left;">Delegated (personal Microsoft account)</td> <td style="text-align: left;">Not supported.</td> <td style="text-align: left;">Not supported.</td> </tr> <tr> <td style="text-align: left;">Application</td> <td style="text-align: left;">Directory.Read.All</td> <td style="text-align: left;">Directory.ReadWrite.All</td> </tr> </tbody> </table> <!-- markdownlint-disable MD041--> <div class="IMPORTANT"> <p>Important</p> <p>When an application queries a relationship that returns a <strong>directoryObject</strong> type collection, if it doesn't have permission to read a certain resource type, members of that type are returned but with limited information. For example, only the <strong>@odata.type</strong> property for the object type and the <strong>id</strong> is returned, while other properties are indicated as <code>null</code>. With this behavior, applications can request the least privileged permissions they need, rather than rely on the set of <em>Directory.</em>* permissions. For details, see <a href="/en-us/graph/permissions-overview#limited-information-returned-for-inaccessible-member-objects" data-linktype="absolute-path">Limited information returned for inaccessible member objects</a>.</p> </div> <div class="TIP"> <p>Tip</p> <ul> <li>Calling the <code>/me/memberOf</code> endpoint requires a signed-in user and therefore a delegated permission. Application permissions are not supported when you use the <code>/me/memberOf</code> endpoint.</li> <li>To list the members of a group with hidden membership, the <code>Member.Read.Hidden</code> permission is required.</li> </ul> </div> <h2 id="http-request">HTTP request</h2> <!-- { "blockType": "ignored" } --> <pre><code class="lang-http">GET /me/memberOf </code></pre> <!-- { "blockType": "ignored" } --> <pre><code class="lang-http">GET /users/{id | userPrincipalName}/memberOf </code></pre> <h2 id="optional-query-parameters">Optional query parameters</h2> <p>This method supports the <a href="/en-us/graph/query-parameters" data-linktype="absolute-path">OData query parameters</a> to help customize the response, including <code>$search</code>, <code>$count</code>, and <code>$filter</code>. OData cast is also enabled; for example, you can cast to get just the <strong>directoryRoles</strong> the user is a member of. You can use <code>$search</code> on the <strong>displayName</strong> property. Items that are added or updated for this resource are specially indexed for use with the <code>$count</code> and <code>$search</code> query parameters. There can be a slight delay between when an item is added or updated and when it's available in the index.</p> <h2 id="request-headers">Request headers</h2> <table> <thead> <tr> <th style="text-align: left;">Header</th> <th style="text-align: left;">Value</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">Authorization</td> <td style="text-align: left;">Bearer {token}. Required. Learn more about <a href="/en-us/graph/auth/auth-concepts" data-linktype="absolute-path">authentication and authorization</a>.</td> </tr> <tr> <td style="text-align: left;">ConsistencyLevel</td> <td style="text-align: left;">eventual. This header and <code>$count</code> are required when using the <code>$search</code>, <code>$filter</code>, <code>$orderby</code>, or OData cast query parameters. It uses an index that might not be up-to-date with recent changes to the object.</td> </tr> </tbody> </table> <h2 id="request-body">Request body</h2> <p>Don't supply a request body for this method.</p> <h2 id="response">Response</h2> <p>If successful, this method returns a <code>200 OK</code> response code and collection of <a href="resources/directoryobject?view=graph-rest-1.0" data-linktype="relative-path">directoryObject</a> objects in the response body.</p> <h2 id="examples">Examples</h2> <h3 id="example-1-get-groups-directory-roles-and-administrative-units-that-the-user-is-a-direct-member-of">Example 1: Get groups, directory roles, and administrative units that the user is a direct member of</h3> <h4 id="request">Request</h4> <p>The following example shows a request.</p> <div class="tabGroup" id="tabgroup_1"> <ul role="tablist"> <li role="presentation"> <a href="#tabpanel_1_http" role="tab" aria-controls="tabpanel_1_http" data-tab="http" tabindex="0" aria-selected="true" data-linktype="self-bookmark">HTTP</a> </li> <li role="presentation"> <a href="#tabpanel_1_csharp" role="tab" aria-controls="tabpanel_1_csharp" data-tab="csharp" tabindex="-1" data-linktype="self-bookmark">C#</a> </li> <li role="presentation"> <a href="#tabpanel_1_cli" role="tab" aria-controls="tabpanel_1_cli" data-tab="cli" tabindex="-1" data-linktype="self-bookmark">CLI</a> </li> <li role="presentation"> <a href="#tabpanel_1_go" role="tab" aria-controls="tabpanel_1_go" data-tab="go" tabindex="-1" data-linktype="self-bookmark">Go</a> </li> <li role="presentation"> <a href="#tabpanel_1_java" role="tab" aria-controls="tabpanel_1_java" data-tab="java" tabindex="-1" data-linktype="self-bookmark">Java</a> </li> <li role="presentation"> <a href="#tabpanel_1_javascript" role="tab" aria-controls="tabpanel_1_javascript" data-tab="javascript" tabindex="-1" data-linktype="self-bookmark">JavaScript</a> </li> <li role="presentation"> <a href="#tabpanel_1_php" role="tab" aria-controls="tabpanel_1_php" data-tab="php" tabindex="-1" data-linktype="self-bookmark">PHP</a> </li> <li role="presentation"> <a href="#tabpanel_1_powershell" role="tab" aria-controls="tabpanel_1_powershell" data-tab="powershell" tabindex="-1" data-linktype="self-bookmark">PowerShell</a> </li> <li role="presentation"> <a href="#tabpanel_1_python" role="tab" aria-controls="tabpanel_1_python" data-tab="python" tabindex="-1" data-linktype="self-bookmark">Python</a> </li> </ul> <section id="tabpanel_1_http" role="tabpanel" data-tab="http"> <!-- { "blockType": "request", "name": "user_get_memberof" }--> <pre><code class="lang-msgraph" data-interactive="msgraph">GET https://graph.microsoft.com/v1.0/users/6e7b768e-07e2-4810-8459-485f84f8f204/memberOf </code></pre> </section> <section id="tabpanel_1_csharp" role="tabpanel" data-tab="csharp" aria-hidden="true" hidden="hidden"> <pre><code class="lang-csharp"> // Code snippets are only available for the latest version. Current version is 5.x // To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp var result = await graphClient.Users["{user-id}"].MemberOf.GetAsync(); </code></pre> <!-- markdownlint-disable MD041--> <blockquote> <p>For details about how to <a href="/en-us/graph/sdks/sdk-installation" data-linktype="absolute-path">add the SDK</a> to your project and <a href="/en-us/graph/sdks/choose-authentication-providers" data-linktype="absolute-path">create an authProvider</a> instance, see the <a href="/en-us/graph/sdks/sdks-overview" data-linktype="absolute-path">SDK documentation</a>.</p> </blockquote> </section> <section id="tabpanel_1_cli" role="tabpanel" data-tab="cli" aria-hidden="true" hidden="hidden"> <pre><code class="lang-bash"> mgc users member-of list --user-id {user-id} </code></pre> <!-- markdownlint-disable MD041--> <blockquote> <p>For details about how to <a href="/en-us/graph/sdks/sdk-installation" data-linktype="absolute-path">add the SDK</a> to your project and <a href="/en-us/graph/sdks/choose-authentication-providers" data-linktype="absolute-path">create an authProvider</a> instance, see the <a href="/en-us/graph/sdks/sdks-overview" data-linktype="absolute-path">SDK documentation</a>.</p> </blockquote> </section> <section id="tabpanel_1_go" role="tabpanel" data-tab="go" aria-hidden="true" hidden="hidden"> <pre><code class="lang-go"> // Code snippets are only available for the latest major version. Current major version is $v1.* // Dependencies import ( "context" msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" //other-imports ) // To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go memberOf, err := graphClient.Users().ByUserId("user-id").MemberOf().Get(context.Background(), nil) </code></pre> <!-- markdownlint-disable MD041--> <blockquote> <p>For details about how to <a href="/en-us/graph/sdks/sdk-installation" data-linktype="absolute-path">add the SDK</a> to your project and <a href="/en-us/graph/sdks/choose-authentication-providers" data-linktype="absolute-path">create an authProvider</a> instance, see the <a href="/en-us/graph/sdks/sdks-overview" data-linktype="absolute-path">SDK documentation</a>.</p> </blockquote> </section> <section id="tabpanel_1_java" role="tabpanel" data-tab="java" aria-hidden="true" hidden="hidden"> <pre><code class="lang-java"> // Code snippets are only available for the latest version. Current version is 6.x GraphServiceClient graphClient = new GraphServiceClient(requestAdapter); DirectoryObjectCollectionResponse result = graphClient.users().byUserId("{user-id}").memberOf().get(); </code></pre> <!-- markdownlint-disable MD041--> <blockquote> <p>For details about how to <a href="/en-us/graph/sdks/sdk-installation" data-linktype="absolute-path">add the SDK</a> to your project and <a href="/en-us/graph/sdks/choose-authentication-providers" data-linktype="absolute-path">create an authProvider</a> instance, see the <a href="/en-us/graph/sdks/sdks-overview" data-linktype="absolute-path">SDK documentation</a>.</p> </blockquote> </section> <section id="tabpanel_1_javascript" role="tabpanel" data-tab="javascript" aria-hidden="true" hidden="hidden"> <pre><code class="lang-javascript"> const options = { authProvider, }; const client = Client.init(options); let memberOf = await client.api('/users/6e7b768e-07e2-4810-8459-485f84f8f204/memberOf') .get(); </code></pre> <!-- markdownlint-disable MD041--> <blockquote> <p>For details about how to <a href="/en-us/graph/sdks/sdk-installation" data-linktype="absolute-path">add the SDK</a> to your project and <a href="/en-us/graph/sdks/choose-authentication-providers" data-linktype="absolute-path">create an authProvider</a> instance, see the <a href="/en-us/graph/sdks/sdks-overview" data-linktype="absolute-path">SDK documentation</a>.</p> </blockquote> </section> <section id="tabpanel_1_php" role="tabpanel" data-tab="php" aria-hidden="true" hidden="hidden"> <pre><code class="lang-php"> <?php use Microsoft\Graph\GraphServiceClient; $graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes); $result = $graphServiceClient->users()->byUserId('user-id')->memberOf()->get()->wait(); </code></pre> <!-- markdownlint-disable MD041--> <blockquote> <p>For details about how to <a href="/en-us/graph/sdks/sdk-installation" data-linktype="absolute-path">add the SDK</a> to your project and <a href="/en-us/graph/sdks/choose-authentication-providers" data-linktype="absolute-path">create an authProvider</a> instance, see the <a href="/en-us/graph/sdks/sdks-overview" data-linktype="absolute-path">SDK documentation</a>.</p> </blockquote> </section> <section id="tabpanel_1_powershell" role="tabpanel" data-tab="powershell" aria-hidden="true" hidden="hidden"> <pre><code class="lang-powershell"> Import-Module Microsoft.Graph.Users Get-MgUserMemberOf -UserId $userId </code></pre> <!-- markdownlint-disable MD041--> <blockquote> <p>For details about how to <a href="/en-us/graph/sdks/sdk-installation" data-linktype="absolute-path">add the SDK</a> to your project and <a href="/en-us/graph/sdks/choose-authentication-providers" data-linktype="absolute-path">create an authProvider</a> instance, see the <a href="/en-us/graph/sdks/sdks-overview" data-linktype="absolute-path">SDK documentation</a>.</p> </blockquote> </section> <section id="tabpanel_1_python" role="tabpanel" data-tab="python" aria-hidden="true" hidden="hidden"> <pre><code class="lang-python"> # Code snippets are only available for the latest version. Current version is 1.x from msgraph import GraphServiceClient # To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python result = await graph_client.users.by_user_id('user-id').member_of.get() </code></pre> <!-- markdownlint-disable MD041--> <blockquote> <p>For details about how to <a href="/en-us/graph/sdks/sdk-installation" data-linktype="absolute-path">add the SDK</a> to your project and <a href="/en-us/graph/sdks/choose-authentication-providers" data-linktype="absolute-path">create an authProvider</a> instance, see the <a href="/en-us/graph/sdks/sdks-overview" data-linktype="absolute-path">SDK documentation</a>.</p> </blockquote> </section> </div> <h4 id="response-1">Response</h4> <p>The following example shows the response.</p> <blockquote> <p><strong>Note:</strong> The response object shown here might be shortened for readability.</p> </blockquote> <!-- { "blockType": "response", "truncated": true, "@odata.type": "microsoft.graph.directoryObject", "isCollection": true } --> <pre><code class="lang-http">HTTP/1.1 200 OK Content-type: application/json { "value": [ { "@odata.type": "#microsoft.graph.group", "displayName": "All Users", "mailEnabled": false, "securityEnabled": true } ] } </code></pre> <h3 id="example-2-get-only-a-count-of-all-groups-directory-roles-and-administrative-units-that-the-user-is-a-direct-member-of">Example 2: Get only a count of all groups, directory roles, and administrative units that the user is a direct member of</h3> <h4 id="request-1">Request</h4> <p>The following example shows a request.</p> <!-- { "blockType": "ignored", "name": "get_user_memberof_count_only" }--> <pre><code class="lang-msgraph" data-interactive="msgraph">GET https://graph.microsoft.com/v1.0/users/{id}/memberOf/$count ConsistencyLevel: eventual </code></pre> <h4 id="response-2">Response</h4> <p>The following example shows the response.</p> <blockquote> <p><strong>Note:</strong> The response object shown here might be shortened for readability.</p> </blockquote> <!-- { "blockType": "response" } --> <pre><code class="lang-http">HTTP/1.1 200 OK Content-type: text/plain 17 </code></pre> <h3 id="example-3-use-odata-cast-to-get-only-a-count-of-group-membership">Example 3: Use OData cast to get only a count of group membership</h3> <h4 id="request-2">Request</h4> <p>The following example shows a request.</p> <!-- { "blockType": "ignored", "name": "get_count_only" }--> <pre><code class="lang-http">GET https://graph.microsoft.com/v1.0/users/{id}/memberOf/microsoft.graph.group/$count ConsistencyLevel: eventual </code></pre> <h4 id="response-3">Response</h4> <p>The following example shows the response.</p> <!-- { "blockType": "response" } --> <pre><code class="lang-http">HTTP/1.1 200 OK Content-type: text/plain 16 </code></pre> <h3 id="example-4-use-search-and-odata-cast-to-get-membership-in-groups-with-display-names-that-contain-the-letters-tier-including-a-count-of-returned-objects">Example 4: Use $search and OData cast to get membership in groups with display names that contain the letters 'tier' including a count of returned objects</h3> <h4 id="request-3">Request</h4> <p>The following example shows a request.</p> <!-- { "blockType": "ignored", "name": "get_tier_count" }--> <pre><code class="lang-http">GET https://graph.microsoft.com/v1.0/users/{id}/memberOf/microsoft.graph.group?$count=true&$orderby=displayName&$search="displayName:tier"&$select=displayName,id ConsistencyLevel: eventual </code></pre> <h4 id="response-4">Response</h4> <p>The following example shows the response.</p> <blockquote> <p><strong>Note:</strong> The response object shown here might be shortened for readability.</p> </blockquote> <!-- { "blockType": "response", "truncated": true, "@odata.type": "microsoft.graph.group", "isCollection": true } --> <pre><code class="lang-http">HTTP/1.1 200 OK Content-type: application/json { "@odata.context":"https://graph.microsoft.com/v1.0/$metadata#groups(displayName,id)", "@odata.count":7, "value":[ { "displayName":"Contoso-tier Query Notification", "id":"11111111-2222-3333-4444-555555555555" } ] } </code></pre> <h3 id="example-5-use-filter-and-odata-cast-to-get-groups-with-a-display-name-that-starts-with-a-including-a-count-of-returned-objects">Example 5: Use $filter and OData cast to get groups with a display name that starts with 'a' including a count of returned objects</h3> <h4 id="request-4">Request</h4> <p>The following example shows a request.</p> <!-- { "blockType": "ignored", "name": "list_users_memberof_startswith" }--> <pre><code class="lang-http">GET https://graph.microsoft.com/v1.0/users/{id}/memberOf/microsoft.graph.group?$count=true&$orderby=displayName&$filter=startswith(displayName, 'a') ConsistencyLevel: eventual </code></pre> <h4 id="response-5">Response</h4> <p>The following example shows the response.</p> <blockquote> <p><strong>Note:</strong> The response object shown here might be shortened for readability.</p> </blockquote> <!-- { "blockType": "response", "truncated": true, "@odata.type": "microsoft.graph.group", "isCollection": true } --> <pre><code class="lang-http">HTTP/1.1 200 OK Content-type: application/json { "@odata.context":"https://graph.microsoft.com/v1.0/$metadata#groups", "@odata.count":76, "value":[ { "displayName":"AAD Contoso Users", "mail":"AADContoso_Users@contoso.com", "mailEnabled":true, "mailNickname":"AADContoso_Users", "securityEnabled":true } ] } </code></pre> <h3 id="example-6-use-filter-and-odata-cast-to-get-groups-with-at-least-one-app-role-assignment">Example 6: Use $filter and OData cast to get groups with at least one app role assignment</h3> <h4 id="request-5">Request</h4> <p>The following example shows a request.</p> <div class="tabGroup" id="tabgroup_2"> <ul role="tablist"> <li role="presentation"> <a href="#tabpanel_2_http" role="tab" aria-controls="tabpanel_2_http" data-tab="http" tabindex="0" aria-selected="true" data-linktype="self-bookmark">HTTP</a> </li> <li role="presentation"> <a href="#tabpanel_2_csharp" role="tab" aria-controls="tabpanel_2_csharp" data-tab="csharp" tabindex="-1" data-linktype="self-bookmark">C#</a> </li> <li role="presentation"> <a href="#tabpanel_2_cli" role="tab" aria-controls="tabpanel_2_cli" data-tab="cli" tabindex="-1" data-linktype="self-bookmark">CLI</a> </li> <li role="presentation"> <a href="#tabpanel_2_go" role="tab" aria-controls="tabpanel_2_go" data-tab="go" tabindex="-1" data-linktype="self-bookmark">Go</a> </li> <li role="presentation"> <a href="#tabpanel_2_java" role="tab" aria-controls="tabpanel_2_java" data-tab="java" tabindex="-1" data-linktype="self-bookmark">Java</a> </li> <li role="presentation"> <a href="#tabpanel_2_javascript" role="tab" aria-controls="tabpanel_2_javascript" data-tab="javascript" tabindex="-1" data-linktype="self-bookmark">JavaScript</a> </li> <li role="presentation"> <a href="#tabpanel_2_php" role="tab" aria-controls="tabpanel_2_php" data-tab="php" tabindex="-1" data-linktype="self-bookmark">PHP</a> </li> <li role="presentation"> <a href="#tabpanel_2_powershell" role="tab" aria-controls="tabpanel_2_powershell" data-tab="powershell" tabindex="-1" data-linktype="self-bookmark">PowerShell</a> </li> <li role="presentation"> <a href="#tabpanel_2_python" role="tab" aria-controls="tabpanel_2_python" data-tab="python" tabindex="-1" data-linktype="self-bookmark">Python</a> </li> </ul> <section id="tabpanel_2_http" role="tabpanel" data-tab="http"> <!-- { "blockType": "request", "name": "list_users_memberof_approleassignments" }--> <pre><code class="lang-msgraph" data-interactive="msgraph">GET https://graph.microsoft.com/v1.0/users/{id}/memberOf/microsoft.graph.group?$filter=appRoleAssignments/$count gt 0&$select=id,displayName </code></pre> </section> <section id="tabpanel_2_csharp" role="tabpanel" data-tab="csharp" aria-hidden="true" hidden="hidden"> <pre><code class="lang-csharp"> // Code snippets are only available for the latest version. Current version is 5.x // To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp var result = await graphClient.Users["{user-id}"].MemberOf.GraphGroup.GetAsync((requestConfiguration) => { requestConfiguration.QueryParameters.Filter = "appRoleAssignments/$count gt 0"; requestConfiguration.QueryParameters.Select = new string []{ "id","displayName" }; }); </code></pre> <!-- markdownlint-disable MD041--> <blockquote> <p>For details about how to <a href="/en-us/graph/sdks/sdk-installation" data-linktype="absolute-path">add the SDK</a> to your project and <a href="/en-us/graph/sdks/choose-authentication-providers" data-linktype="absolute-path">create an authProvider</a> instance, see the <a href="/en-us/graph/sdks/sdks-overview" data-linktype="absolute-path">SDK documentation</a>.</p> </blockquote> </section> <section id="tabpanel_2_cli" role="tabpanel" data-tab="cli" aria-hidden="true" hidden="hidden"> <pre><code class="lang-bash"> mgc users member-of graph-group get --user-id {user-id} --filter "appRoleAssignments/$count gt 0" --select "id,displayName" </code></pre> <!-- markdownlint-disable MD041--> <blockquote> <p>For details about how to <a href="/en-us/graph/sdks/sdk-installation" data-linktype="absolute-path">add the SDK</a> to your project and <a href="/en-us/graph/sdks/choose-authentication-providers" data-linktype="absolute-path">create an authProvider</a> instance, see the <a href="/en-us/graph/sdks/sdks-overview" data-linktype="absolute-path">SDK documentation</a>.</p> </blockquote> </section> <section id="tabpanel_2_go" role="tabpanel" data-tab="go" aria-hidden="true" hidden="hidden"> <pre><code class="lang-go"> // Code snippets are only available for the latest major version. Current major version is $v1.* // Dependencies import ( "context" msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" graphusers "github.com/microsoftgraph/msgraph-sdk-go/users" //other-imports ) requestFilter := "appRoleAssignments/$count gt 0" requestParameters := &graphusers.UserItemMemberOfGraph.groupRequestBuilderGetQueryParameters{ Filter: &requestFilter, Select: [] string {"id","displayName"}, } configuration := &graphusers.UserItemMemberOfGraph.groupRequestBuilderGetRequestConfiguration{ QueryParameters: requestParameters, } // To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go graphGroup, err := graphClient.Users().ByUserId("user-id").MemberOf().GraphGroup().Get(context.Background(), configuration) </code></pre> <!-- markdownlint-disable MD041--> <blockquote> <p>For details about how to <a href="/en-us/graph/sdks/sdk-installation" data-linktype="absolute-path">add the SDK</a> to your project and <a href="/en-us/graph/sdks/choose-authentication-providers" data-linktype="absolute-path">create an authProvider</a> instance, see the <a href="/en-us/graph/sdks/sdks-overview" data-linktype="absolute-path">SDK documentation</a>.</p> </blockquote> </section> <section id="tabpanel_2_java" role="tabpanel" data-tab="java" aria-hidden="true" hidden="hidden"> <pre><code class="lang-java"> // Code snippets are only available for the latest version. Current version is 6.x GraphServiceClient graphClient = new GraphServiceClient(requestAdapter); GroupCollectionResponse result = graphClient.users().byUserId("{user-id}").memberOf().graphGroup().get(requestConfiguration -> { requestConfiguration.queryParameters.filter = "appRoleAssignments/$count gt 0"; requestConfiguration.queryParameters.select = new String []{"id", "displayName"}; }); </code></pre> <!-- markdownlint-disable MD041--> <blockquote> <p>For details about how to <a href="/en-us/graph/sdks/sdk-installation" data-linktype="absolute-path">add the SDK</a> to your project and <a href="/en-us/graph/sdks/choose-authentication-providers" data-linktype="absolute-path">create an authProvider</a> instance, see the <a href="/en-us/graph/sdks/sdks-overview" data-linktype="absolute-path">SDK documentation</a>.</p> </blockquote> </section> <section id="tabpanel_2_javascript" role="tabpanel" data-tab="javascript" aria-hidden="true" hidden="hidden"> <pre><code class="lang-javascript"> const options = { authProvider, }; const client = Client.init(options); let group = await client.api('/users/{id}/memberOf/microsoft.graph.group') .filter('appRoleAssignments/$count gt 0') .select('id,displayName') .get(); </code></pre> <!-- markdownlint-disable MD041--> <blockquote> <p>For details about how to <a href="/en-us/graph/sdks/sdk-installation" data-linktype="absolute-path">add the SDK</a> to your project and <a href="/en-us/graph/sdks/choose-authentication-providers" data-linktype="absolute-path">create an authProvider</a> instance, see the <a href="/en-us/graph/sdks/sdks-overview" data-linktype="absolute-path">SDK documentation</a>.</p> </blockquote> </section> <section id="tabpanel_2_php" role="tabpanel" data-tab="php" aria-hidden="true" hidden="hidden"> <pre><code class="lang-php"> <?php use Microsoft\Graph\GraphServiceClient; use Microsoft\Graph\Generated\Users\Item\MemberOf\Graph\Group\GroupRequestBuilderGetRequestConfiguration; $graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes); $requestConfiguration = new GraphGroupRequestBuilderGetRequestConfiguration(); $queryParameters = GraphGroupRequestBuilderGetRequestConfiguration::createQueryParameters(); $queryParameters->filter = "appRoleAssignments/\$count gt 0"; $queryParameters->select = ["id","displayName"]; $requestConfiguration->queryParameters = $queryParameters; $result = $graphServiceClient->users()->byUserId('user-id')->memberOf()->graphGroup()->get($requestConfiguration)->wait(); </code></pre> <!-- markdownlint-disable MD041--> <blockquote> <p>For details about how to <a href="/en-us/graph/sdks/sdk-installation" data-linktype="absolute-path">add the SDK</a> to your project and <a href="/en-us/graph/sdks/choose-authentication-providers" data-linktype="absolute-path">create an authProvider</a> instance, see the <a href="/en-us/graph/sdks/sdks-overview" data-linktype="absolute-path">SDK documentation</a>.</p> </blockquote> </section> <section id="tabpanel_2_powershell" role="tabpanel" data-tab="powershell" aria-hidden="true" hidden="hidden"> <pre><code class="lang-powershell"> Import-Module Microsoft.Graph.Users Get-MgUserMemberOfAsGroup -UserId $userId -Filter "appRoleAssignments/`$count gt 0" -Property "id,displayName" </code></pre> <!-- markdownlint-disable MD041--> <blockquote> <p>For details about how to <a href="/en-us/graph/sdks/sdk-installation" data-linktype="absolute-path">add the SDK</a> to your project and <a href="/en-us/graph/sdks/choose-authentication-providers" data-linktype="absolute-path">create an authProvider</a> instance, see the <a href="/en-us/graph/sdks/sdks-overview" data-linktype="absolute-path">SDK documentation</a>.</p> </blockquote> </section> <section id="tabpanel_2_python" role="tabpanel" data-tab="python" aria-hidden="true" hidden="hidden"> <pre><code class="lang-python"> # Code snippets are only available for the latest version. Current version is 1.x from msgraph import GraphServiceClient from msgraph.generated.users.item.member_of.graph.group.group_request_builder import GroupRequestBuilder from kiota_abstractions.base_request_configuration import RequestConfiguration # To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python query_params = GroupRequestBuilder.GroupRequestBuilderGetQueryParameters( filter = "appRoleAssignments/$count gt 0", select = ["id","displayName"], ) request_configuration = RequestConfiguration( query_parameters = query_params, ) result = await graph_client.users.by_user_id('user-id').member_of.graph_group.get(request_configuration = request_configuration) </code></pre> <!-- markdownlint-disable MD041--> <blockquote> <p>For details about how to <a href="/en-us/graph/sdks/sdk-installation" data-linktype="absolute-path">add the SDK</a> to your project and <a href="/en-us/graph/sdks/choose-authentication-providers" data-linktype="absolute-path">create an authProvider</a> instance, see the <a href="/en-us/graph/sdks/sdks-overview" data-linktype="absolute-path">SDK documentation</a>.</p> </blockquote> </section> </div> <h4 id="response-6">Response</h4> <p>The following example shows the response.</p> <blockquote> <p><strong>Note:</strong> The response object shown here might be shortened for readability.</p> </blockquote> <!-- { "blockType": "response", "truncated": true, "@odata.type": "microsoft.graph.group", "isCollection": true } --> <pre><code class="lang-http">HTTP/1.1 200 OK Content-type: application/json { "@odata.context":"https://graph.microsoft.com/v1.0/$metadata#groups", "value":[ { "id": "c11b732b-0e16-46c1-b0fa-bd32c8a42455", "displayName":"All users" }, { "id": "3f927b40-06f8-4352-b8e4-37a7ba04b7ff", "displayName":"AAD Contoso Users" } ] } </code></pre> <!-- uuid: 8fcb5dbc-d5aa-4681-8e31-b001d5168d79 2015-10-25 14:57:30 UTC --> <!-- { "type": "#page.annotation", "description": "List memberOf", "keywords": "", "section": "documentation", "tocPath": "", "suppressions": [ ] }--> </div><div id="ms--inline-notifications" class="margin-block-xs" data-bi-name="inline-notification"></div><div id="assertive-live-region" role="alert" aria-live="assertive" class="visually-hidden" aria-relevant="additions" aria-atomic="true"></div> <div id="polite-live-region" role="status" aria-live="polite" class="visually-hidden" aria-relevant="additions" aria-atomic="true"></div> <!-- </content> --> </main><!-- recommendations section --><!-- end recommendations section --> <!-- feedback section --><section id="site-user-feedback-footer" class="font-size-sm margin-top-md" data-test-id="site-user-feedback-footer" data-bi-name="site-feedback-section"> <hr class="hr" /> <h2 id="feedback" class="title is-3">Feedback</h2> <div class="display-flex flex-wrap-wrap align-items-center"> <p class="font-weight-semibold margin-xxs margin-left-none">Was this page helpful?</p> <div class="buttons"> <button class="thumb-rating-button like button button-primary button-sm" data-test-id="footer-rating-yes" data-binary-rating-response="rating-yes" type="button" title="This article is helpful" data-bi-name="button-rating-yes" aria-pressed="false" > <span class="icon" aria-hidden="true"> <span class="docon docon-like"></span> </span> <span>Yes</span> </button> <button class="thumb-rating-button dislike button button-primary button-sm" data-test-id="footer-rating-no" data-binary-rating-response="rating-no" type="button" title="This article is not helpful" data-bi-name="button-rating-no" aria-pressed="false" > <span class="icon" aria-hidden="true"> <span class="docon docon-dislike"></span> </span> <span>No</span> </button> </div> </div><div class="display-flex flex-wrap-wrap margin-top-xxs"><div> <a data-bi-name="provide-feedback-cta" class="has-external-link-indicator" href="https://developer.microsoft.com/graph/support" data-bi-name="product-feedback" > <span>Provide product feedback</span> </a></div></div> </section><!-- end feedback section --> <!-- feedback report section --><!-- end feedback report section --><aside id="ms--additional-resources-mobile" aria-label="Additional resources" class="display-none-desktop display-none-print" > <hr class="hr" hidden /> <h2 id="ms--additional-resources-mobile-heading" class="title is-3" hidden>Additional resources</h2> <section id="right-rail-recommendations-mobile" data-bi-name="recommendations" hidden></section> <section id="right-rail-training-mobile" data-bi-name="learning-resources-card" hidden></section> <section id="right-rail-events-mobile" data-bi-name="events-card" hidden></section> <section id="right-rail-qna-mobile" data-bi-name="qna-link-card" hidden></section> </aside><div class="border-top is-visible-interactive has-default-focus margin-top-sm "><footer id="footer-interactive" data-bi-name="footer" class="footer-layout"><div class="display-flex gap-xs flex-wrap-wrap is-full-height padding-right-lg-desktop"><a data-mscc-ic="false" class="locale-selector-link button button-sm button-clear flex-shrink-0" href="#" data-bi-name="select-locale"> <span class="icon" aria-hidden="true"> <span class="docon docon-world"></span> </span> <span class="local-selector-link-text"></span></a><div class="ccpa-privacy-link" data-ccpa-privacy-link hidden> <a href="https://aka.ms/yourcaliforniaprivacychoices" class="button button-sm button-clear flex-shrink-0" data-mscc-ic="false" data-bi-name="your-privacy-choices" > <svg role="img" aria-label="California Consumer Privacy Act (CCPA) Opt-Out Icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 14" xml:space="preserve" height="16" width="43" focusable="false" > <title>California Consumer Privacy Act (CCPA) Opt-Out Icon</title> <path d="M7.4 12.8h6.8l3.1-11.6H7.4C4.2 1.2 1.6 3.8 1.6 7s2.6 5.8 5.8 5.8z" style="fill-rule:evenodd;clip-rule:evenodd;fill:#fff"></path> <path d="M22.6 0H7.4c-3.9 0-7 3.1-7 7s3.1 7 7 7h15.2c3.9 0 7-3.1 7-7s-3.2-7-7-7zm-21 7c0-3.2 2.6-5.8 5.8-5.8h9.9l-3.1 11.6H7.4c-3.2 0-5.8-2.6-5.8-5.8z" style="fill-rule:evenodd;clip-rule:evenodd;fill:#06f"></path> <path d="M24.6 4c.2.2.2.6 0 .8L22.5 7l2.2 2.2c.2.2.2.6 0 .8-.2.2-.6.2-.8 0l-2.2-2.2-2.2 2.2c-.2.2-.6.2-.8 0-.2-.2-.2-.6 0-.8L20.8 7l-2.2-2.2c-.2-.2-.2-.6 0-.8.2-.2.6-.2.8 0l2.2 2.2L23.8 4c.2-.2.6-.2.8 0z" style="fill:#fff"></path> <path d="M12.7 4.1c.2.2.3.6.1.8L8.6 9.8c-.1.1-.2.2-.3.2-.2.1-.5.1-.7-.1L5.4 7.7c-.2-.2-.2-.6 0-.8.2-.2.6-.2.8 0L8 8.6l3.8-4.5c.2-.2.6-.2.9 0z" style="fill:#06f"></path> </svg> <span>Your Privacy Choices</span> </a> </div> <div class="flex-shrink-0"> <div class="dropdown has-caret-up"> <button class="dropdown-trigger button button-clear button-sm has-inner-focus theme-dropdown-trigger" aria-controls="theme-menu-interactive" aria-expanded="false" title="Theme" data-bi-name="theme"> <span class="icon"> <span class="docon docon-sun" aria-hidden="true"></span> </span> <span>Theme</span> <span class="icon expanded-indicator" aria-hidden="true"> <span class="docon docon-chevron-down-light"></span> </span> </button> <div class="dropdown-menu" id="theme-menu-interactive" role="menu"> <ul class="theme-selector padding-xxs" role="none"> <li class="theme display-block" role="menuitem"> <button class="button button-clear button-sm theme-control button-block justify-content-flex-start" data-theme-to="light"> <span class="theme-light margin-right-xxs"> <span class="theme-selector-icon border display-inline-block has-body-background" aria-hidden="true"> <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 14"> <rect width="22" height="14" class="has-fill-body-background" /> <rect x="5" y="5" width="12" height="4" class="has-fill-secondary" /> <rect x="5" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="8" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="11" y="2" width="3" height="1" class="has-fill-secondary" /> <rect x="1" y="1" width="2" height="2" class="has-fill-secondary" /> <rect x="5" y="10" width="7" height="2" rx="0.3" class="has-fill-primary" /> <rect x="19" y="1" width="2" height="2" rx="1" class="has-fill-secondary" /> </svg> </span> </span> <span>Light</span> </button> </li> <li class="theme display-block" role="menuitem"> <button class="button button-clear button-sm theme-control button-block justify-content-flex-start" data-theme-to="dark"> <span class="theme-dark margin-right-xxs"> <span class="border theme-selector-icon display-inline-block has-body-background" aria-hidden="true"> <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 14"> <rect width="22" height="14" class="has-fill-body-background" /> <rect x="5" y="5" width="12" height="4" class="has-fill-secondary" /> <rect x="5" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="8" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="11" y="2" width="3" height="1" class="has-fill-secondary" /> <rect x="1" y="1" width="2" height="2" class="has-fill-secondary" /> <rect x="5" y="10" width="7" height="2" rx="0.3" class="has-fill-primary" /> <rect x="19" y="1" width="2" height="2" rx="1" class="has-fill-secondary" /> </svg> </span> </span> <span>Dark</span> </button> </li> <li class="theme display-block" role="menuitem"> <button class="button button-clear button-sm theme-control button-block justify-content-flex-start" data-theme-to="high-contrast"> <span class="theme-high-contrast margin-right-xxs"> <span class="border theme-selector-icon display-inline-block has-body-background" aria-hidden="true"> <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 14"> <rect width="22" height="14" class="has-fill-body-background" /> <rect x="5" y="5" width="12" height="4" class="has-fill-secondary" /> <rect x="5" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="8" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="11" y="2" width="3" height="1" class="has-fill-secondary" /> <rect x="1" y="1" width="2" height="2" class="has-fill-secondary" /> <rect x="5" y="10" width="7" height="2" rx="0.3" class="has-fill-primary" /> <rect x="19" y="1" width="2" height="2" rx="1" class="has-fill-secondary" /> </svg> </span> </span> <span>High contrast</span> </button> </li> </ul> </div> </div> </div> </div> <ul class="links" data-bi-name="footerlinks"> <li class="manage-cookies-holder" hidden></li><li><a class="external-link-indicator" data-mscc-ic="false" href="/en-us/previous-versions/" data-bi-name="archivelink">Previous Versions</a></li> <li><a class="external-link-indicator" data-mscc-ic="false" href="https://techcommunity.microsoft.com/t5/microsoft-learn-blog/bg-p/MicrosoftLearnBlog" data-bi-name="bloglink">Blog</a></li> <li><a class="external-link-indicator" data-mscc-ic="false" href="/en-us/contribute/" data-bi-name="contributorGuide">Contribute</a></li><li><a class="external-link-indicator" data-mscc-ic="false" href="https://go.microsoft.com/fwlink/?LinkId=521839" data-bi-name="privacy">Privacy</a></li><li><a class="external-link-indicator" data-mscc-ic="false" href="/en-us/legal/termsofuse" data-bi-name="termsofuse">Terms of Use</a></li><li><a class="external-link-indicator" data-mscc-ic="false" href="https://www.microsoft.com/legal/intellectualproperty/Trademarks/" data-bi-name="trademarks">Trademarks</a></li><li>© Microsoft 2024</li> </ul> </footer></div></div><div id="ms--additional-resources" class="right-container column is-4-desktop display-none display-block-desktop" data-bi-name="pageactions" role="complementary" aria-label="Additional resources" > <div id="affixed-right-container" class="margin-top-sm-tablet" data-bi-name="right-column"> <h2 id="ms--additional-resources-heading" class="title is-6 margin-top-md" hidden>Additional resources</h2> <section id="right-rail-events" data-bi-name="events-card" hidden></section> <section id="right-rail-training" data-bi-name="learning-resources-card" hidden></section> <section id="right-rail-recommendations" data-bi-name="recommendations" hidden></section> <nav id="side-doc-outline" class="doc-outline" data-bi-name="intopic toc" aria-label="In this article"> <h3>In this article</h3> </nav> <section id="right-rail-qna" class="margin-top-xxs" data-bi-name="qna-link-card" hidden></section> </div> </div></div> <!--end of div.columns --> </section> <!--end of .primary-holder --> <!-- interactive container --> <aside id="interactive-container" class="interactive-container is-visible-interactive column has-body-background-dark "> </aside> <!-- end of interactive container --> </div> </div> <!--end of .mainContainer --> <section class="border-top has-default-focus is-hidden-interactive margin-top-sm "><footer id="footer" data-bi-name="footer" class="footer-layout uhf-container has-padding" role="contentinfo"><div class="display-flex gap-xs flex-wrap-wrap is-full-height padding-right-lg-desktop"><a data-mscc-ic="false" class="locale-selector-link button button-sm button-clear flex-shrink-0" href="#" data-bi-name="select-locale"> <span class="icon" aria-hidden="true"> <span class="docon docon-world"></span> </span> <span class="local-selector-link-text"></span></a><div class="ccpa-privacy-link" data-ccpa-privacy-link hidden> <a href="https://aka.ms/yourcaliforniaprivacychoices" class="button button-sm button-clear flex-shrink-0" data-mscc-ic="false" data-bi-name="your-privacy-choices" > <svg role="img" aria-label="California Consumer Privacy Act (CCPA) Opt-Out Icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 14" xml:space="preserve" height="16" width="43" focusable="false" > <title>California Consumer Privacy Act (CCPA) Opt-Out Icon</title> <path d="M7.4 12.8h6.8l3.1-11.6H7.4C4.2 1.2 1.6 3.8 1.6 7s2.6 5.8 5.8 5.8z" style="fill-rule:evenodd;clip-rule:evenodd;fill:#fff"></path> <path d="M22.6 0H7.4c-3.9 0-7 3.1-7 7s3.1 7 7 7h15.2c3.9 0 7-3.1 7-7s-3.2-7-7-7zm-21 7c0-3.2 2.6-5.8 5.8-5.8h9.9l-3.1 11.6H7.4c-3.2 0-5.8-2.6-5.8-5.8z" style="fill-rule:evenodd;clip-rule:evenodd;fill:#06f"></path> <path d="M24.6 4c.2.2.2.6 0 .8L22.5 7l2.2 2.2c.2.2.2.6 0 .8-.2.2-.6.2-.8 0l-2.2-2.2-2.2 2.2c-.2.2-.6.2-.8 0-.2-.2-.2-.6 0-.8L20.8 7l-2.2-2.2c-.2-.2-.2-.6 0-.8.2-.2.6-.2.8 0l2.2 2.2L23.8 4c.2-.2.6-.2.8 0z" style="fill:#fff"></path> <path d="M12.7 4.1c.2.2.3.6.1.8L8.6 9.8c-.1.1-.2.2-.3.2-.2.1-.5.1-.7-.1L5.4 7.7c-.2-.2-.2-.6 0-.8.2-.2.6-.2.8 0L8 8.6l3.8-4.5c.2-.2.6-.2.9 0z" style="fill:#06f"></path> </svg> <span>Your Privacy Choices</span> </a> </div> <div class="flex-shrink-0"> <div class="dropdown has-caret-up"> <button class="dropdown-trigger button button-clear button-sm has-inner-focus theme-dropdown-trigger" aria-controls="theme-menu" aria-expanded="false" title="Theme" data-bi-name="theme"> <span class="icon"> <span class="docon docon-sun" aria-hidden="true"></span> </span> <span>Theme</span> <span class="icon expanded-indicator" aria-hidden="true"> <span class="docon docon-chevron-down-light"></span> </span> </button> <div class="dropdown-menu" id="theme-menu" role="menu"> <ul class="theme-selector padding-xxs" role="none"> <li class="theme display-block" role="menuitem"> <button class="button button-clear button-sm theme-control button-block justify-content-flex-start" data-theme-to="light"> <span class="theme-light margin-right-xxs"> <span class="theme-selector-icon border display-inline-block has-body-background" aria-hidden="true"> <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 14"> <rect width="22" height="14" class="has-fill-body-background" /> <rect x="5" y="5" width="12" height="4" class="has-fill-secondary" /> <rect x="5" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="8" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="11" y="2" width="3" height="1" class="has-fill-secondary" /> <rect x="1" y="1" width="2" height="2" class="has-fill-secondary" /> <rect x="5" y="10" width="7" height="2" rx="0.3" class="has-fill-primary" /> <rect x="19" y="1" width="2" height="2" rx="1" class="has-fill-secondary" /> </svg> </span> </span> <span>Light</span> </button> </li> <li class="theme display-block" role="menuitem"> <button class="button button-clear button-sm theme-control button-block justify-content-flex-start" data-theme-to="dark"> <span class="theme-dark margin-right-xxs"> <span class="border theme-selector-icon display-inline-block has-body-background" aria-hidden="true"> <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 14"> <rect width="22" height="14" class="has-fill-body-background" /> <rect x="5" y="5" width="12" height="4" class="has-fill-secondary" /> <rect x="5" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="8" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="11" y="2" width="3" height="1" class="has-fill-secondary" /> <rect x="1" y="1" width="2" height="2" class="has-fill-secondary" /> <rect x="5" y="10" width="7" height="2" rx="0.3" class="has-fill-primary" /> <rect x="19" y="1" width="2" height="2" rx="1" class="has-fill-secondary" /> </svg> </span> </span> <span>Dark</span> </button> </li> <li class="theme display-block" role="menuitem"> <button class="button button-clear button-sm theme-control button-block justify-content-flex-start" data-theme-to="high-contrast"> <span class="theme-high-contrast margin-right-xxs"> <span class="border theme-selector-icon display-inline-block has-body-background" aria-hidden="true"> <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 14"> <rect width="22" height="14" class="has-fill-body-background" /> <rect x="5" y="5" width="12" height="4" class="has-fill-secondary" /> <rect x="5" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="8" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="11" y="2" width="3" height="1" class="has-fill-secondary" /> <rect x="1" y="1" width="2" height="2" class="has-fill-secondary" /> <rect x="5" y="10" width="7" height="2" rx="0.3" class="has-fill-primary" /> <rect x="19" y="1" width="2" height="2" rx="1" class="has-fill-secondary" /> </svg> </span> </span> <span>High contrast</span> </button> </li> </ul> </div> </div> </div> </div> <ul class="links" data-bi-name="footerlinks"> <li class="manage-cookies-holder" hidden></li><li><a class="external-link-indicator" data-mscc-ic="false" href="/en-us/previous-versions/" data-bi-name="archivelink">Previous Versions</a></li> <li><a class="external-link-indicator" data-mscc-ic="false" href="https://techcommunity.microsoft.com/t5/microsoft-learn-blog/bg-p/MicrosoftLearnBlog" data-bi-name="bloglink">Blog</a></li> <li><a class="external-link-indicator" data-mscc-ic="false" href="/en-us/contribute/" data-bi-name="contributorGuide">Contribute</a></li><li><a class="external-link-indicator" data-mscc-ic="false" href="https://go.microsoft.com/fwlink/?LinkId=521839" data-bi-name="privacy">Privacy</a></li><li><a class="external-link-indicator" data-mscc-ic="false" href="/en-us/legal/termsofuse" data-bi-name="termsofuse">Terms of Use</a></li><li><a class="external-link-indicator" data-mscc-ic="false" href="https://www.microsoft.com/legal/intellectualproperty/Trademarks/" data-bi-name="trademarks">Trademarks</a></li><li>© Microsoft 2024</li> </ul> </footer> </section> <div id="action-panel" role="region" aria-label="Action Panel" class="action-panel has-default-focus" tabindex="-1"></div> </body> </html>