
I'm looking at the documentation https://appwrite.io/docs/client/teams?sdk=web-default#teamsList which is very close to what I need, but I want to be able to get a list of the teams a user belongs to, basically I want to be able to supply it with a user ID and it will give me a list of the teams for that user:
const promise = teams.list(userId);
Is this possible?

Not with the client SDK. You could however use the Users API to do exactly this on the server-side.
You'll have to create a function in your appwrite console that uses the users.listMemberships('[USER_ID]')
resource to do this.
Users API: https://appwrite.io/docs/server/users?sdk=nodejs-default
Reference for users.listMemberships
: https://appwrite.io/docs/server/users?sdk=nodejs-default#usersListMemberships
Guide to Appwrite Functions: https://appwrite.io/docs/functions
Reference for executing functions from the client-side: https://appwrite.io/docs/client/functions

Thank you! That works!

Will be marking this as solved, but feel free to come back and ask any questions if you face problems 😁

[SOLVED] How to get a user's team(s)?
Recommended threads
- How To Send Email Verification From Serv...
How can I send email verification from server action or component after sign up in next.js ? Is there any way ?
- x-appwrite-user-jwt missing
Even for logged in users I can't see "x-appwrite-user-jwt" or "x-appwrite-user-id" in headers of an appwrite function. I'm trying to send "x-appwrite-user-id" m...
- ATTRIBUTE NOT SHOWING DELETE
Hi, I'm trying to delete an attribute in my collection but it won't delete, It's not even showing the delete when I click on the hamburger icon, Its showing onl...
