Hi to all,
I'm new here and new to C# programming so sorry if I'm
missing things which aren't allowed in the forum.
I'm trying to implement a software which can (at the first stage) display a list of a YouTube user's playlists,
using a windows form application.
I've see quiet a few videos and articles, and viewed the Google API site, but I have some things missing out.
I'm Basing myself on the code as appears in this site - https://automatetheplanet.com/youtube-playlists-api-csharp-code/
This is what I've started with in at my form -
how do I interact with the function 'GetUserPlayLists' below so to get the list of playlists ?
the part of code below exists in a different file , 'YouTubeServiceClient', under the namespace YouTubePlaylistAPI:
besides, Do I need to added code in the 'TODO' comment or that's optional?
Thanks in advance,
Amitai
I'm new here and new to C# programming so sorry if I'm
missing things which aren't allowed in the forum.
I'm trying to implement a software which can (at the first stage) display a list of a YouTube user's playlists,
using a windows form application.
I've see quiet a few videos and articles, and viewed the Google API site, but I have some things missing out.
I'm Basing myself on the code as appears in this site - https://automatetheplanet.com/youtube-playlists-api-csharp-code/
This is what I've started with in at my form -
C#:
namespace YouTubeTest
{
public partial class FormGetPlaylist : Form
{
public FormGetPlaylist()
{
InitializeComponent();
}
private void buttonGoclick_Click(object sender, EventArgs e)
{
listBoxPlaylists.Items.Clear();
string userEmail = textBoxUsersName.Text;
List<YouTubePlayList>
//YouTubeVideo[] playlists = YouTubeAPI.GetPlaylist(userEmail);
foreach (var playlist in playlists)
{
listBoxPlaylists.Items.Add(playlist);
}
}
}
}
how do I interact with the function 'GetUserPlayLists' below so to get the list of playlists ?
the part of code below exists in a different file , 'YouTubeServiceClient', under the namespace YouTubePlaylistAPI:
C#:
...
public List<YouTubePlayList> GetUserPlayLists(string userEmail)
{
var playLists = new List<YouTubePlayList>();
try
{
var service = new YouTubeServiceClient();
service.GetUserPlayListsAsync(userEmail, playLists).Wait();
}
catch (AggregateException ex)
{
foreach (var e in ex.InnerExceptions)
{
//TODO: Add Logging
}
}
return playLists;
}
....
besides, Do I need to added code in the 'TODO' comment or that's optional?
Thanks in advance,
Amitai