我想从我的 YouTube 频道中删除选择了视频 ID 的视频,虽然MultiSelection
属性ListBox
已打开,但代码不起作用,还有其他解决方案吗?我收到如下错误:
Execution of request failed: http://gdata.youtube.com/feeds/api/users/xxxxxx/uploads/System.Windows.Forms.ListBox+SelectedObjectCollection
这是我的代码:
public void delete()
{
YouTubeRequestSettings settings = new YouTubeRequestSettings(my app name,
my dev key,
my username,
my password);
YouTubeRequest request = new YouTubeRequest(settings);
Uri videoEntryUrl = new Uri(String.Format("http://gdata.youtube.com/feeds/api/users/{0}/uploads/{1}", my channel name, list.checkedItems));
Video video = request.Retrieve<Video>(videoEntryUrl);
request.Delete(video);
}
填充 CheckedListBox 的代码
Feed<Video> videoFeed;
string feedUrl = "https://gdata.youtube.com/feeds/api/users/default/uploads";
videoFeed = request.Get<Video>(new Uri(feedUrl));
foreach (Video entry in videoFeed.Entries)
{
list.Items.Add(entry.VideoId,0);
}