Skip to content

Twitter Lists : Members

linvi edited this page May 20, 2015 · 10 revisions

Overview

Twitter Lists are composed of members. These members are users whose public tweets will be available from the List.

Let's code

Get List's Members

// From a List object
var members = list.GetMembers(<maximumNumberOfMembersToRetrieve>);

// From the Static TwitterList
var members = TwitterList.GetMembersOfList(<list_identifier>, <maximumNumberOfMembersToRetrieve>);

Add Members to a List

// You can add users to a list by specifying their id, screen name or by giving an `User` object.
var success = list.AddMember(<user_identifier>);

// Here is the static way to add a member to a list
var success = TwitterList.AddMemberToList(<list_identifier>, <user_identifier>);

When adding multiple members the return is of type MultiRequestsResult.

var multiRequestResult = TweetList.AddMultipleMembersToList(<list_identifier>, Enumerable<user_identifiers>);

Check Membership

You can check if a user is a member of a list.

var isMember = list.CheckUserMembership(<user_identifier>);
var isMember = TwitterList.CheckIfUserIsAListSubscriber(<list_identifier>, <user_identifier>);

Remove Members from a List

// You can remove users from a list by specifying their id, screen name or by giving an `User` object.
var success = list.RemoveMember(<user_identifier>);

// Here is the static way to remove a member from a list
var success = TwitterList.RemoveMemberToList(<list_identifier>, <user_identifier>);

When removing multiple members the return is of type MultiRequestsResult.

var multiRequestResult = TwitterList.RemoveMultipleMembersFromList(<list_identifier>, Enumerable<user_identifiers>);
Clone this wiki locally