Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs
Hello Akshay,
Welcome to Microsoft Q&A. Thank you for your detailed query regarding Microsoft Graph permissions. I will address your inquiries as below:
- Fetching channels for teams where the user is not a member:
Your setup uses delegated permissions, which are tied to the signed-in user's access. This means the API enforces restrictions based on the user's membership in the team, leading to the 403 Forbidden error when the user isn't a member. Delegated permissions like Channel.ReadBasic.All only allow access to channels in teams the user has joined or has explicit access to. You can switch to application permissions (app-only authentication via client credentials flow) to access tenant-wide data without user membership restrictions. This allows fetching all teams and channels across the tenant.
- List all teams: Use
/groups?$filter=groupTypes/any(c:c eq 'Unified'). List channels: Use/teams/{team-id}/channels. - Required Permissions (Application type, requiring admin consent):
-
Group.Read.Allfor listing teams. -
Channel.ReadBasic.AllorChannelSettings.Read.Allfor channel details.
-
- Notes: Update your app registration in Microsoft Entra ID to include these as application permissions, grant admin consent, and authenticate without a user context. This resolves the UI limitation of not displaying the full channel list.
- Outlook OAuth Token generation issue:
The "Contact your admin" popup during OAuth token generation typically occurs when the app requires permissions that need admin consent, or when tenant settings restrict user consent (like user consent is disabled, or the app is unverified/multi-tenant and triggers a review workflow). Even if authentication succeeds, token issuance fails until resolved. This isn't a bug in your code but a security/enforcement mechanism in Microsoft Entra ID.
- Ensure admin consent is granted for the app. Use the Microsoft Entra admin center (Enterprise applications > Permissions > Grant admin consent) or an admin consent URL. If user consent is disabled, enable it or configure the admin consent workflow to allow users to request approval.
- Your listed scopes (e.g.,
Mail.Read,Mail.ReadWrite,User.ReadBasic.All) are generally sufficient, but high-privilege ones likeUser.ReadBasic.Alltrigger admin consent. Remove unnecessary high-privilege scopes if possible to simplify.
REF: https://learn.microsoft.com/en-us/entra/identity/enterprise-apps/configure-admin-consent-workflow
This setup should enable full access without the reported issues. If you encounter specific error codes or need code samples, please comment below.
Hope this help.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.