Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            SessionAwareCoreServiceClient client = new SessionAwareCoreServiceClient("netTcp_2013");

            ContentManager cm = new ContentManager(client);
            List<Source> sources = cm.GetSources();

            XDocument opml = XDocument.Load("feeds.xml");
            foreach (XElement node in opml.Root.Elements("body").Elements("outline"))
            {
                // check if it already exists
                string url = node.Attribute("xmlUrl").Value;
                bool found = sources.Any(source => source.RssFeedUrl == url);
                if (!found)
                {
                    Source source = new Source(client)
                    {
                        RssFeedUrl = url,
                        Title = node.Attribute("text").Value
                    };
                    source.Save();
                    Console.WriteLine("Created new source: " + source.Title);
                }
            }
        }
Ejemplo n.º 2
0
 //public List<Page> GetNewsletterPages()
 //{
 //    List<Page> result = new List<Page>();
 //    StructureGroup sg = (StructureGroup)_session.GetObject(Constants.NewsletterStructureGroupUrl);
 //    OrganizationalItemItemsFilter filter = new OrganizationalItemItemsFilter(_session) { ItemTypes = new[] { ItemType.Page } };
 //    foreach (Page page in sg.GetItems(filter))
 //    {
 //        result.Add(page);
 //    }
 //    return result;
 //}
 public List<Article> GetArticlesForSource(Source source)
 {
     List<Article> result = new List<Article>();
     UsingItemsFilterData filter = new UsingItemsFilterData { ItemTypes = new[] { ItemType.Component } };
     foreach (var xNode in _client.GetListXml(source.Id, filter).Nodes())
     {
         var node = (XElement) xNode;
         result.Add(new Article((ComponentData)_client.Read(node.Attribute("ID").Value, _readOptions), _client));
     }
     return result;
 }