Megabytemb / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

YouTube API Delete Video Problem .Net #580

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, the Visual Studio C# reports object reference not set to an instance of an 
object when trying to delete a video by using:
Uri videoEntryUrl = new 
Uri("http://gdata.youtube.com/feeds/api/videos/11111111111");
            Video video = request.Retrieve<Video>(videoEntryUrl);
            //YOUTUBE BUG>>>
              request.Delete(video);

i have check and video exists and its not null

descriptions also here
http://stackoverflow.com/questions/8712305/i-want-to-delete-a-video-from-my-chan
nel-on-youtube-using-the-api

Original issue reported on code.google.com by mar...@gmail.com on 6 Apr 2012 at 11:15

GoogleCodeExporter commented 9 years ago
The Delete method works as expected if you use the right url, i.e. the one from 
the /upload feed.

The entries in the /videos feed do not have an edit url which is the one that 
must be used to send a delete request. I just updated the library (rev. 1169) 
to return a more meaningful ArgumentNullException instead of the generic null 
reference.

Please use this code to delete a video you uploaded:

YouTubeRequestSettings settings = new YouTubeRequestSettings(YOUTUBE_CHANNEL, 
YOUTUBE_DEVELOPER_KEY, USERNAME, PASSWORD);
YouTubeRequest request = new YouTubeRequest(settings);
Uri videoEntryUrl = new 
Uri(String.Format("http://gdata.youtube.com/feeds/api/users/{0}/uploads/{1}", 
YOUTUBE_CHANNEL, VIDEO_ID));
Video video = request.Retrieve<Video>(videoEntryUrl);
request.Delete(video);

Original comment by ccherub...@google.com on 11 Apr 2012 at 11:04

GoogleCodeExporter commented 9 years ago
thank you !

Original comment by mar...@gmail.com on 14 Apr 2012 at 1:40