Copied to clipboard

Flag this post as spam?

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


  • Erik Ernst 70 posts 90 karma points
    May 29, 2010 @ 13:38
    Erik Ernst
    0

    Creating Members from other application using SQL

    I have written a function in Microsoft Dynamics NAV/Navision which I am using to synchronize changes between the members in Umbraco and a similar table in Navision. Initially the purpose has been to insert the members who registered an account on our website into Navision, and then allow our employees to update their accounts from Navision. But now we would like also to be able to insert new members into Umbraco.

    I know it's possible to use the Umbraco Member API to do this, and for someone who is an expert .NET programmer, then this might have been quite easy. But in this case the code needs to be done inside Navision using ADO.

    As I said then it works fine to update using the Umbraco Member and Umbraco Property Data tables. But as for what I can see then I also need to insert a new record into the UmbracoNode table. That's not really the problem, but creating the Unique ID and Node Object Type fields looks like a mystery to me.

     

    Rgds,
    Erik

  • Aaron Powell 1708 posts 3046 karma points c-trib
    May 30, 2010 @ 03:52
    Aaron Powell
    1

    Don't try and do the sql yourself, you'll only end up in a world of pain.

    You've got two good options that you can use instead:

    • Create members via a webservice
    • Create a custom membership provider to your the Navision database
    Creating members programatically isn't very hard and there's plenty of other posts on this forum about how to do it. And by doing it via a web service you don't even need the Umbraco assemblies in your other site.
    If you really must create the members using SQL then you'll need to generate a unique ID (which is a GUID, that is unique for that instance) and set the Node Object Type to the GUID that identifies a member (you'll have to check the source for that one).

  • Richard Soeteman 4035 posts 12842 karma points MVP
    May 31, 2010 @ 12:23
    Richard Soeteman
    0

    Hi Erik,

    Don't know if its possible to export the members from Navision, if it is you can use CMSImport to import the members into Umbraco. Based on the login it will detect if the member needs to be created or updated.

    Cheers,

    Richard

  • Erik Ernst 70 posts 90 karma points
    Jun 01, 2010 @ 07:43
    Erik Ernst
    0

    Hi Richard,

    Thanks, but the actual update of the members in Umbraco is not a problem - I'm only having a problem creating new members.

    Hi Lace,

    Could you tell me more about the webservice function? I never heard about that option.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 01, 2010 @ 08:46
    Dirk De Grave
    0

    Hi Erik,

    Add a webreference to http://SITEROOT/umbraco/webservices/api/memberservice.asmx in your project and you'll be able to find a create method on this service to create members from outside the umbraco application.

    Don't forget to enable webservices in umbracoSettings.config

     

    <!-- configuration for webservices -->
      <!-- webservices are disabled by default. Set enable="True" to enable them -->
      <webservices enabled="True">
        <!-- You must set user-rights for each service. Enter the usernames seperated with comma (,) -->
        <documentServiceUsers>your-username</documentServiceUsers>
        <fileServiceUsers>your-username</fileServiceUsers>
        <stylesheetServiceUsers>your-username</stylesheetServiceUsers>
        <memberServiceUsers>your-username</memberServiceUsers>
        <templateServiceUsers>your-username</templateServiceUsers>
        <!-- type of files (extensions) that are allowed for the file service -->
        <fileServiceFolders>css,xslt</fileServiceFolders>
      </webservices>

    and assign users that have access to the webservice. Be aware that username/password combination passed in as last arguments to the create method should be the hashed password (if that's set as passwordFormat in web.config)... unless you use Darren's project which uses the membership provider to authenticate against the umbraco member database

     

    Hope this helps.

    Regards,

    /Dirk

     

Please Sign in or register to post replies

Write your reply to:

Draft