Copied to clipboard

Flag this post as spam?

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


  • Alex Campbell 47 posts 69 karma points
    Jan 20, 2011 @ 18:32
    Alex Campbell
    0

    Member Properties not in cmsContentXml until Save

    I'm building a site which will be integrated in more or less realtime with another internal system. To create and update Umbraco Members I am using a windows service which throws data at the the Members Webservice to create and update them, I think I have to use the WebService as some of the API functionality relies on HttpContext which of course I don't have access to from a windows service.

    So, when I come to export Members from Umbraco back into my external system I am trying to load in the members' data in SQL, I'm getting the xml from cmsContentXml and then manipulating it so that I can load each field into a database table.

    The problem is this... When I get the cmsContentXml xml it does not contain any generic property data... It seems the xml is only updated after I do a manual save from the Members section. Is this right or am I missing something here? Is there a way to force the cmsContentXml data to update when I first put the member in?

    SQL below:

    IF

     

    OBJECT_ID('tempdb..#tempXml') IS NOT NULL

     

    BEGIN

     

    DROP TABLE #tempXml

     

    END

     

    CREATE

     

    TABLE #tempXml (

    nodeId

    int,

    xmlData

    xml

    )

    INSERT

     

    INTO #tempXml (nodeId, xmlData)

    (

     

     

    SELECT

    m

    .nodeId,

     

    RTRIM(CAST('<nodes>' AS char)) + CAST(x.[xml] AS varchar(max)) + RTRIM(CAST('</nodes>' AS char)) AS xmlData

     

    FROM

    cmsMember

    AS m

     

    INNER JOIN cmsContentXml AS x ON m.nodeId = x.nodeId

     

    INNER JOIN customWebChanges as WC

     

    on wc.entityid = m.nodeId

     

    and wc.dbtable = 'cmsMember'

     

    and wc.dateprocessed IS NULL

     

    and wc.status = 'pending'

     

    WHERE m.nodeId IN

     

     

    (

    --change/update tracking table

     

    SELECT entityid as nodeId

     

    FROM customWebChanges

     

    WHERE [status] = 'pending'

     

    AND dateprocessed IS NULL

     

    )

    )

     

    SELECT

    nodeId

    ,

    pref

    .value('./@email', 'varchar(50)') as Email,

    pref

    .value('(memberTitle/text())[1]', 'varchar(50)') as Title,

    pref

    .value('(memberInitials/text())[1]', 'varchar(50)') as Initials,

    pref

    .value('(memberSurname/text())[1]', 'varchar(50)') as Surname

    FROM

     

    #tempXml

    CROSS APPLY

    xmlData

    .nodes('/nodes/node') AS People(pref)

     

    DROP

     

    TABLE #tempXml

  • Alex Campbell 47 posts 69 karma points
    May 10, 2011 @ 15:46
    Alex Campbell
    0

    The answer here was to always ensure that after any kind of member update we always do a member.save() and then the XML is always up-to-date.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies