Reputation: 2364
I am currently writing an application that is posting Tweets to my Twitter timeline using Twitterizer.
However I would also like to have the option to delete multiple Tweets.
I have managed to delete individual Tweets by manually retrieving the statusID's of from the site then hard coding them into my method, as shown below.
int statusID = 12345; //retrieved from the individual Tweet online
TwitterResponse<TwitterStatus> tweetResponse = TwitterStatus.Delete(tokens, statusID);
if (tweetResponse.Result == RequestResult.Success)
{
MessageBox.Show(tweetResponse.Result.ToString());
}
Is it possible to retrive a list of statusID's that this method could loop over and for each exisiting ID, delete that comment?
Also, is it possible to add Geo coordinates when updating a status using Twitterizer?
Upvotes: 0
Views: 325
Reputation: 11063
I have a code that allows you to loop through the ID's. In this case it is using TwitterFriendShip Class, but It should be the same using the other tweet classes:
friendCol = TwitterFriendship.FriendsIds(tokens, options);
Cursor = friendCol.ResponseObject.NextCursor;
foreach (int usuario in friendCol.ResponseObject)
{
usuarios newUser = new usuarios();
newUser.userId = usuario;
FollowingList.Add(newUser);
}
for (int i = 0; i < FollowingList.Count -1; i++)
{
//Delete by userID
TwitterResponse<TwitterUser> ans= TwitterFriendship.Delete(tokens, FollowingList[i].userId);
}
Try this, to get the tweets in timeline and delete them using the id;
EDIT:
TwitterStatusCollection staCol = TwitterTimeline.UserTimeline(tokens).ResponseObject;
foreach (TwitterStatus status in staCol)
{
status.Delete(tokens);
}
NOTE: The TwitterStatus Class has ID and StringID properties
Upvotes: 1