4 formatted code to get rid of horizontal scroll bar
source | link

I am retrieving components in a specified folder using Core Services to build an API to expose some content. We have a preview and live environment and I need to retrieve components that have been published to the "live" environment only

code being used for retrieving components:

private static void LoadExistingProducts()
{
    LinkToSchemaData[] schemaLinks = new[] {
        new LinkToSchemaData { 
            IdRef = ConfigurationManager.AppSettings["productSchema"] 
        }
    };

    // Define a filter to return only Components.
    OrganizationalItemItemsFilterData componentFilter = new OrganizationalItemItemsFilterData
    {
        ItemTypes = new[] { ItemType.Component },
        BasedOnSchemas = schemaLinks
    };

    //get xml list of existing product components
    existingProducts = client.GetListXml(
                                    ConfigurationManager.AppSettings["productComponentFolder"],
                                    componentFilter);

    ComponentData component = null;
    XmlSerializer serializer = new XmlSerializer(typeof(Tridion_Product));

    foreach (XElement element in existingProducts.Elements())
    {
        component = (ComponentData)client.Read(element.Attribute("ID").Value, null);
        StringReader readr = new StringReader(component.Content);
        MyReader reader = new MyReader(readr);
        Tridion_Product product = serializer.Deserialize(reader) as Tridion_Product;
        //Place deserialized version of existing object in dictionary for comparison step
        ProductDictionary.Add(product.ProductID, product);
    }
}

I am retrieving components in a specified folder using Core Services to build an API to expose some content. We have a preview and live environment and I need to retrieve components that have been published to the "live" environment only

code being used for retrieving components:

private static void LoadExistingProducts()
{
    LinkToSchemaData[] schemaLinks = new[] {
        new LinkToSchemaData { 
            IdRef = ConfigurationManager.AppSettings["productSchema"] 
        }
    };

    // Define a filter to return only Components.
    OrganizationalItemItemsFilterData componentFilter = new OrganizationalItemItemsFilterData
    {
        ItemTypes = new[] { ItemType.Component },
        BasedOnSchemas = schemaLinks
    };

    //get xml list of existing product components
    existingProducts = client.GetListXml(ConfigurationManager.AppSettings["productComponentFolder"], componentFilter);

    ComponentData component = null;
    XmlSerializer serializer = new XmlSerializer(typeof(Tridion_Product));

    foreach (XElement element in existingProducts.Elements())
    {
        component = (ComponentData)client.Read(element.Attribute("ID").Value, null);
        StringReader readr = new StringReader(component.Content);
        MyReader reader = new MyReader(readr);
        Tridion_Product product = serializer.Deserialize(reader) as Tridion_Product;
        //Place deserialized version of existing object in dictionary for comparison step
        ProductDictionary.Add(product.ProductID, product);
    }
}

I am retrieving components in a specified folder using Core Services to build an API to expose some content. We have a preview and live environment and I need to retrieve components that have been published to the "live" environment only

code being used for retrieving components:

private static void LoadExistingProducts()
{
    LinkToSchemaData[] schemaLinks = new[] {
        new LinkToSchemaData { 
            IdRef = ConfigurationManager.AppSettings["productSchema"] 
        }
    };

    // Define a filter to return only Components.
    OrganizationalItemItemsFilterData componentFilter = new OrganizationalItemItemsFilterData
    {
        ItemTypes = new[] { ItemType.Component },
        BasedOnSchemas = schemaLinks
    };

    //get xml list of existing product components
    existingProducts = client.GetListXml(
                                    ConfigurationManager.AppSettings["productComponentFolder"],
                                    componentFilter);

    ComponentData component = null;
    XmlSerializer serializer = new XmlSerializer(typeof(Tridion_Product));

    foreach (XElement element in existingProducts.Elements())
    {
        component = (ComponentData)client.Read(element.Attribute("ID").Value, null);
        StringReader readr = new StringReader(component.Content);
        MyReader reader = new MyReader(readr);
        Tridion_Product product = serializer.Deserialize(reader) as Tridion_Product;
        //Place deserialized version of existing object in dictionary for comparison step
        ProductDictionary.Add(product.ProductID, product);
    }
}
3 deleted 9 characters in body
source | link

I am retrieving components in a specified folder using Core Services to build an API to expose some content. We have a preview and live environment and I need to retrieve components that have been published to the "live" environment only

code being used for retrieving components:

private static void LoadExistingProducts()
{
    LinkToSchemaData[] schemaLinks = new[] {
        new LinkToSchemaData { 
            IdRef = ConfigurationManager.AppSettings["productSchema"] 
        }
    };

    // Define a filter to return only Components.
    OrganizationalItemItemsFilterData componentFilter = new OrganizationalItemItemsFilterData
    {
        ItemTypes = new[] { ItemType.Component },
        BasedOnSchemas = schemaLinks
    };

    //get xml list of existing product components
    existingProducts = client.GetListXml(ConfigurationManager.AppSettings["productComponentFolder"], componentFilter);

    ComponentData component = null;
    XmlSerializer serializer = new XmlSerializer(typeof(Tridion_AN_ProductTridion_Product));

    foreach (XElement element in existingProducts.Elements())
    {
        component = (ComponentData)client.Read(element.Attribute("ID").Value, null);
        StringReader readr = new StringReader(component.Content);
        MyReader reader = new MyReader(readr);
        Tridion_AN_ProductTridion_Product product = serializer.Deserialize(reader) as Tridion_AN_Product;Tridion_Product;
        //Place deserialized version of existing object in dictionary for comparison step
        ProductDictionary.Add(product.ProductID, product);
    }
}

I am retrieving components in a specified folder using Core Services to build an API to expose some content. We have a preview and live environment and I need to retrieve components that have been published to the "live" environment only

code being used for retrieving components:

private static void LoadExistingProducts()
{
    LinkToSchemaData[] schemaLinks = new[] {
        new LinkToSchemaData { 
            IdRef = ConfigurationManager.AppSettings["productSchema"] 
        }
    };

    // Define a filter to return only Components.
    OrganizationalItemItemsFilterData componentFilter = new OrganizationalItemItemsFilterData
    {
        ItemTypes = new[] { ItemType.Component },
        BasedOnSchemas = schemaLinks
    };

    //get xml list of existing product components
    existingProducts = client.GetListXml(ConfigurationManager.AppSettings["productComponentFolder"], componentFilter);

    ComponentData component = null;
    XmlSerializer serializer = new XmlSerializer(typeof(Tridion_AN_Product));

    foreach (XElement element in existingProducts.Elements())
    {
        component = (ComponentData)client.Read(element.Attribute("ID").Value, null);
        StringReader readr = new StringReader(component.Content);
        MyReader reader = new MyReader(readr);
        Tridion_AN_Product product = serializer.Deserialize(reader) as Tridion_AN_Product;
        //Place deserialized version of existing object in dictionary for comparison step
        ProductDictionary.Add(product.ProductID, product);
    }
}

I am retrieving components in a specified folder using Core Services to build an API to expose some content. We have a preview and live environment and I need to retrieve components that have been published to the "live" environment only

code being used for retrieving components:

private static void LoadExistingProducts()
{
    LinkToSchemaData[] schemaLinks = new[] {
        new LinkToSchemaData { 
            IdRef = ConfigurationManager.AppSettings["productSchema"] 
        }
    };

    // Define a filter to return only Components.
    OrganizationalItemItemsFilterData componentFilter = new OrganizationalItemItemsFilterData
    {
        ItemTypes = new[] { ItemType.Component },
        BasedOnSchemas = schemaLinks
    };

    //get xml list of existing product components
    existingProducts = client.GetListXml(ConfigurationManager.AppSettings["productComponentFolder"], componentFilter);

    ComponentData component = null;
    XmlSerializer serializer = new XmlSerializer(typeof(Tridion_Product));

    foreach (XElement element in existingProducts.Elements())
    {
        component = (ComponentData)client.Read(element.Attribute("ID").Value, null);
        StringReader readr = new StringReader(component.Content);
        MyReader reader = new MyReader(readr);
        Tridion_Product product = serializer.Deserialize(reader) as Tridion_Product;
        //Place deserialized version of existing object in dictionary for comparison step
        ProductDictionary.Add(product.ProductID, product);
    }
}
    Tweeted twitter.com/#!/StackTridion/status/428476043276861440
2 Formatted the code
source | link

I am retrieving components in a specified folder using Core Services to build an API to expose some content. We have a preview and live environment and iI need to retrieve components that have been published to the "live" environment only

code being used for retrieving components:

        private static void LoadExistingProducts()
    {
        LinkToSchemaData[] schemaLinks = new[] {
        new LinkToSchemaData {  
         new LinkToSchemaData{  IdRef = ConfigurationManager.AppSettings["productSchema"] }
        };

    };

    // Define a filter to return only Components.
        OrganizationalItemItemsFilterData componentFilter = new OrganizationalItemItemsFilterData
        {
            ItemTypes = new[] { ItemType.Component },
            BasedOnSchemas = schemaLinks
        };

        //get xml list of existing product components
        existingProducts = client.GetListXml(ConfigurationManager.AppSettings["productComponentFolder"], componentFilter);

        ComponentData component = null;
        XmlSerializer serializer = new XmlSerializer(typeof(Tridion_AN_Product));

        foreach (XElement element in existingProducts.Elements())
        {
            component = (ComponentData)client.Read(element.Attribute("ID").Value, null);
            StringReader readr = new StringReader(component.Content);
            MyReader reader = new MyReader(readr);
            Tridion_AN_Product product = serializer.Deserialize(reader) as Tridion_AN_Product;
            //Place deserialized version of existing object in dictionary for comparison step
            ProductDictionary.Add(product.ProductID, product);
        }
    }

I am retrieving components in a specified folder using Core Services to build an API to expose some content. We have a preview and live environment and i need to retrieve components that have been published to the "live" environment only

code being used for retrieving components:

        private static void LoadExistingProducts()
    {
        LinkToSchemaData[] schemaLinks = new[] {
                new LinkToSchemaData{ IdRef = ConfigurationManager.AppSettings["productSchema"] }
        };

        // Define a filter to return only Components.
        OrganizationalItemItemsFilterData componentFilter = new OrganizationalItemItemsFilterData
        {
            ItemTypes = new[] { ItemType.Component },
            BasedOnSchemas = schemaLinks
        };

        //get xml list of existing product components
        existingProducts = client.GetListXml(ConfigurationManager.AppSettings["productComponentFolder"], componentFilter);

        ComponentData component = null;
        XmlSerializer serializer = new XmlSerializer(typeof(Tridion_AN_Product));

        foreach (XElement element in existingProducts.Elements())
        {
            component = (ComponentData)client.Read(element.Attribute("ID").Value, null);
            StringReader readr = new StringReader(component.Content);
            MyReader reader = new MyReader(readr);
            Tridion_AN_Product product = serializer.Deserialize(reader) as Tridion_AN_Product;
            //Place deserialized version of existing object in dictionary for comparison step
            ProductDictionary.Add(product.ProductID, product);
        }
    }

I am retrieving components in a specified folder using Core Services to build an API to expose some content. We have a preview and live environment and I need to retrieve components that have been published to the "live" environment only

code being used for retrieving components:

private static void LoadExistingProducts()
{
    LinkToSchemaData[] schemaLinks = new[] {
        new LinkToSchemaData {  
            IdRef = ConfigurationManager.AppSettings["productSchema"] 
        }
    };

    // Define a filter to return only Components.
    OrganizationalItemItemsFilterData componentFilter = new OrganizationalItemItemsFilterData
    {
        ItemTypes = new[] { ItemType.Component },
        BasedOnSchemas = schemaLinks
    };

    //get xml list of existing product components
    existingProducts = client.GetListXml(ConfigurationManager.AppSettings["productComponentFolder"], componentFilter);

    ComponentData component = null;
    XmlSerializer serializer = new XmlSerializer(typeof(Tridion_AN_Product));

    foreach (XElement element in existingProducts.Elements())
    {
        component = (ComponentData)client.Read(element.Attribute("ID").Value, null);
        StringReader readr = new StringReader(component.Content);
        MyReader reader = new MyReader(readr);
        Tridion_AN_Product product = serializer.Deserialize(reader) as Tridion_AN_Product;
        //Place deserialized version of existing object in dictionary for comparison step
        ProductDictionary.Add(product.ProductID, product);
    }
}
1
source | link