/// <summary> /// Gets a summary of all the pages from the blog with the spefied blogId. /// </summary> /// <param name="blogid">The blogid.</param> /// <param name="username">The username.</param> /// <param name="password">The password.</param> /// <returns></returns> public wpPageSummary[] getPageList(string blogid, string username, string password) { if (User.validateCredentials(username, password, false)) { ArrayList blogPosts = new ArrayList(); ArrayList blogPostsObjects = new ArrayList(); User u = new User(username); Channel userChannel = new Channel(u.Id); Document rootDoc; if (userChannel.StartNode > 0) { rootDoc = new Document(userChannel.StartNode); } else { rootDoc = new Document(u.StartNodeId); } //store children array here because iterating over an Array object is very inneficient. var c = rootDoc.Children; foreach (Document d in c) { int count = 0; blogPosts.AddRange( findBlogPosts(userChannel, d, u.Name, ref count, 999, userChannel.FullTree)); } blogPosts.Sort(new DocumentSortOrderComparer()); foreach (Object o in blogPosts) { Document d = (Document)o; wpPageSummary p = new wpPageSummary(); p.dateCreated = d.CreateDateTime; p.page_title = d.Text; p.page_id = d.Id; p.page_parent_id = d.Parent.Id; blogPostsObjects.Add(p); } return((wpPageSummary[])blogPostsObjects.ToArray(typeof(wpPageSummary))); } else { return(null); } }
/// <summary> /// Gets a summary of all the pages from the blog with the spefied blogId. /// </summary> /// <param name="blogid">The blogid.</param> /// <param name="username">The username.</param> /// <param name="password">The password.</param> /// <returns></returns> public wpPageSummary[] getPageList(string blogid, string username, string password) { if (User.validateCredentials(username, password, false)) { ArrayList blogPosts = new ArrayList(); ArrayList blogPostsObjects = new ArrayList(); User u = new User(username); Channel userChannel = new Channel(u.Id); Document rootDoc; if (userChannel.StartNode > 0) rootDoc = new Document(userChannel.StartNode); else rootDoc = new Document(u.StartNodeId); //store children array here because iterating over an Array object is very inneficient. var c = rootDoc.Children; foreach (Document d in c) { int count = 0; blogPosts.AddRange( findBlogPosts(userChannel, d, u.Name, ref count, 999, userChannel.FullTree)); } blogPosts.Sort(new DocumentSortOrderComparer()); foreach (Object o in blogPosts) { Document d = (Document)o; wpPageSummary p = new wpPageSummary(); p.dateCreated = d.CreateDateTime; p.page_title = d.Text; p.page_id = d.Id; p.page_parent_id = d.Parent.Id; blogPostsObjects.Add(p); } return (wpPageSummary[])blogPostsObjects.ToArray(typeof(wpPageSummary)); } else { return null; } }