var credentials = new GDataCredentials(userName, password); var service = new YouTubeService(applicationName, developerKey) {Credentials = credentials}; var entry = new AtomEntry {Title = {Text = playlistName}}; entry = service.Insert(new Uri(YouTubeQuery.CreatePlaylistsUri(null)), entry); var id = ((XmlExtension) entry.FindExtension("playlistId", YouTubeNameTable.NSYouTube)).Node.InnerText; var batchUri = new Uri(string.Format("https://gdata.youtube.com/feeds/api/playlists/{0}/batch", id)); var query = new YouTubeQuery(YouTubeQuery.CreateUserUri(sourceUser)) {StartIndex = 1}; AtomFeed feed; do { feed = service.Query(query); service.Batch(feed, batchUri); query.StartIndex += feed.Entries.Count; } while (query.StartIndex < feed.TotalResults);Google Data API .NET client library
Friday, January 20, 2012
Create a YouTube playlist containing all the uploads of a given user
Sunday, January 8, 2012
List the users of a TFS project associated with a local workspace path
var workspace = Workstation.Current.GetLocalWorkspaceInfo(path); var tfs = new TfsTeamProjectCollection(workspace.ServerUri); var gss = tfs.GetService<IGroupSecurityService>(); var grp = gss.ReadIdentity(SearchFactor.EveryoneApplicationGroup, null, QueryMembership.Expanded); var names = gss.ReadIdentities(SearchFactor.Sid, grp.Members, QueryMembership.None) .Where(identity => identity.Type == IdentityType.WindowsUser) .Select(identity => string.Format(@"{0}\{1}", identity.Domain, identity.AccountName)) .ToArray();
Friday, January 6, 2012
Quartz scheduler job that re-triggers itself on completion
public class RetriggerJob : IInterruptableJob { private bool _interrupted; public void Execute(IJobExecutionContext context) { Thread.Sleep(1000); if (_interrupted) { return; } context.Scheduler.TriggerJob(context.JobDetail.Key); if (_interrupted) { context.Scheduler.Interrupt(context.JobDetail.Key); } } public void Interrupt() { _interrupted = true; } }Quartz.NET
Subscribe to:
Posts (Atom)