Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Luke Alderton 192 posts 509 karma points
    Feb 10, 2014 @ 14:53
    Luke Alderton
    0

    ContentService updating checboxlist in document cache

    Hi,

    I'm creating about 500 pages in a new Umbraco v6.1.6 website using an import script I've coded. I'm using the ContentService api to create the new pages. They are created and seem to save fine. However if I request the value of a checbox list from one of the new pages, I get an empty string.

    I've verified that the property is empty in the umbraco.config file however If I manually save the page from the Umbraco back office. the cache will update with the correct value and I suddenly get the correct value returned.

    Is there a way to force a cache update or some other form of fix for this issue?

    This is the CreateContent method I'm using:

    public static IContent CreateContent(string name, string documentTypeAlias, int parentId, Dictionary properties, bool publish = false, int author = 0)
    {
        IContent document = null;
    
        ContentService contentService = new ContentService();
        document = contentService.CreateContent(
                        name, // the name of the document
                        parentId, // the parent id should be the id of the group node 
                        documentTypeAlias, // the alias of the Document Type
                        author);
    
        foreach (string property in properties.Keys)
        {
            document.SetValue(property, properties[property]);
        }
    
        // If publish is true, then save and publish the document
        if (publish)
        {
            contentService.SaveAndPublish(document);
        }
        // Else, just save it
        else
        {
            contentService.Save(document);
        }
    
        return document;
    }

    Thanks in advance,
    Luke

     

    Edit:

    After looking into the database, I can see that cmsContentXml has the property but the data within it is the same as umbraco.config. I looked into cmsPropertyData and the data is present. So I guess the question is how do I get the data from cmsPropertyData to cmsContentXml?

Please Sign in or register to post replies

Write your reply to:

Draft