Copied to clipboard

Flag this post as spam?

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


  • Paul Marden 235 posts 338 karma points MVP 2x c-trib
    Dec 21, 2010 @ 20:02
    Paul Marden
    0

    Duplicate User name! A member with the user name Fullname already exists

    i'm not sure why I keep getting this error when loading in members, there are no duplicates in my csv file for sure.  i've even tried loadin the username with a unique id column I added to the csv.

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Dec 22, 2010 @ 07:54
    Richard Soeteman
    0

    Hi Paul,

    Are you using headers in the csv file and did you assign the correct textindicator and delimiter. If you want me to look at the csv file please email it to richard [at] soetemansoftware.nl.

    Thanks,

    Richard

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Jan 13, 2011 @ 11:25
    Richard Soeteman
    0

    This was due top a bug. When you don't assign a loginName a member with an empty login is being created. This is fixed in version 1.2 of CMSImport.

  • Martin Lingstuyl 202 posts 379 karma points
    Jul 09, 2014 @ 08:31
    Martin Lingstuyl
    0

    Hi Richard,

    I'm having this same error, but in a different context. It seems CmsImport first creates a member with the columnname as loginname. And then while saving its changed to the actual value. Or something... (umbraco 6.2.1, CMSImport 2.5.x)

    What Happens is this:

    1) I'm importing a member xml file, which is quite plain. Person Nodes containing all kinds of nodes which are imported into properties.

    2) The Import ran into a duplicate emailaddress, which was in the xml file..

    3) It generated an error for that record and every next record.


    Error while importing data for property 'adres', datasource record regnr = '1060', Error :Duplicate Email! A member with the e-mail [email protected] already exists
    Error while importing data for property 'adres', datasource record regnr = '1728', Error :Duplicate User name! A member with the user name regnr already exists
    Error while importing data for property 'adres', datasource record regnr = '1729', Error :Duplicate User name! A member with the user name regnr already exists
    Error while importing data for property 'adres', datasource record regnr = '1730', Error :Duplicate User name! A member with the user name regnr already exists
    Error while importing data for property 'adres', datasource record regnr = '1731', Error :Duplicate User name! A member with the user name regnr already exists

    So to recap: it appears that cmsimport on every record first creates it using 'regnr' as loginname (which is the xmlnodename mapped to the loginname)

    Then after being imported it changes the regnr loginname to the actual regnr value. Which is for example 1060.

    But if it runs into an error, (for example the duplicate emailaddress) the member with the 'regnr' loginname is not updated. and therefore, everytime it tries to add a new member with the temporary loginname 'regnr'. it runs into the duplicate username error.

    Two questions: 1) Do you know of a way around this?

    2) Is it possible to create a check for duplicate emailaddresses during the import. (for example in the importing event) And how would that work?

     

    thanks!

    Martin

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Jul 10, 2014 @ 10:13
    Richard Soeteman
    1

    HI Martin,

    I can confirm that the duplicate username is a bug indeed. Stupid that I never seen this. If you install this version https://www.dropbox.com/s/5g1rw8b1riizng7/CMSImport%202.5.3.zip that bug is already solved.

    To check if an email address already exists you could use MemberService.GetByEmail as mentioned here http://our.umbraco.org/documentation/Reference/Management-v6/Services/MemberService but what would you do with it? Email address would still be duplicate. It's not CMSImport but Umbraco that is throwing the exception.

    Hope this fixes your initial issue,

    Richard

  • Martin Lingstuyl 202 posts 379 karma points
    Jul 10, 2014 @ 12:25
    Martin Lingstuyl
    0

    thanks richard,

    i will give it a go.

    about the emailaddresses... so it is possible to replace the emailfields with an empty string in the importing event with the help of the getbyemail method? that would be okay by me.

     

     

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Jul 10, 2014 @ 13:02
    Richard Soeteman
    0

    Assign Null then CMSImport doesn't map the value. But I don't know if Umbraco likes members without email adresses could be an error thrown as well.

  • Martin Lingstuyl 202 posts 379 karma points
    Jul 10, 2014 @ 14:32
    Martin Lingstuyl
    0

    Hi Richard,

     

    Thats great. So I can just load the member, change the member property and then Save() it?

    (Members without email seems to be fine if you add members programmatically. )

     

    Martin

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Jul 10, 2014 @ 14:53
    Richard Soeteman
    0

    Hi Martin,

    Yes that should work.

    Best,

    Richard

  • Martin Lingstuyl 202 posts 379 karma points
    Jul 21, 2014 @ 12:55
    Martin Lingstuyl
    0

    Hi richard,

     

    Okay, so I tried it. This is my custom event code. It does not work though. It still generates the error ":Duplicate Email! A member with the e-mail [email protected] already exists"

    Any ideas?

    I checked it in debug mode: it does hit the member.Email = ""; line

     

    void MemberImport_RecordImporting(object sender, RecordImportingEventArgs e)
            {
              
                //Get Member
                var ms = ApplicationContext.Current.Services.MemberService;
                var m = (Member)sender;
                var member = ms.GetById(m.Id);

                //Empty Email field if email is already in use
                if (!string.IsNullOrEmpty(e.Items["email"].ToString()))
                {
                    if (ms.GetByEmail(e.Items["email"].ToString()) != null) member.Email = "";
                }

                ms.Save(member, false);
            } 
  • Martin Lingstuyl 202 posts 379 karma points
    Jul 21, 2014 @ 13:20
    Martin Lingstuyl
    0

    by the way: your fix for the other issue worked. thanks a lot!

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Jul 22, 2014 @ 08:46
    Richard Soeteman
    0

    Empty email fields will not work in Umbraco I Think? can you add a fake email address as value?

  • Martin Lingstuyl 202 posts 379 karma points
    Jul 22, 2014 @ 10:55
    Martin Lingstuyl
    0

    Hi Richard,

    Empty email fields are allowed. (at least for all versions below umb 7). That is: while creating a member through the umbraco UI it's a required field, but when creating through code, its okay to leave it empty.

    I worked it out though: the problem with CMSImport is that it creates the member object before the RecordImporting event. And if you map the import email field to the member Email property, CMSImport already tried adding the member with the existing email, and running into the error, all before RecordImporting has any chance to change anything.

    The solution was quite simple: not mapping the email field, and adding it afterwards in the recordimporting or recordimported event, of course only if it isn't already used.

    thanks for your quick answers. Great package!

    Martin

     

  • Martin Lingstuyl 202 posts 379 karma points
    Jul 22, 2014 @ 10:57
    Martin Lingstuyl
    0

    By the way: i tried saving (within the recordimporting event) through the old member object and the new memberservice. It seems (ive been Importing 2000+ members) that the new memberservice is way slower!! (too bad, but at least interesting)

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Jul 22, 2014 @ 12:34
    Richard Soeteman
    0

    Hi Martin,

    Great you found a work around and weird that it threw errors then since it's Umbraco that throws the exception.

    Best,

    Richard

  • Martin Lingstuyl 202 posts 379 karma points
    Jul 23, 2014 @ 09:05
    Martin Lingstuyl
    0

    Yeah, it is an umbraco exception, though if you would add a BeforeRecordImporting event which gives access to the data before it creates an umbraco member, it would be ultimate :). But well, thats probably not a much requested feature, since I'm obviously the first to run into this.

     

    Anyway, one problem solved. Have a great day!

     

     

  • MikeD 92 posts 112 karma points
    Nov 07, 2014 @ 15:53
    MikeD
    0

    Good morning everyone,

    I am having a strange issue importing members for a client.  I am importing 12,000 or so records via an xlsx file, and I keep getting a ton of these same errors.  First, why would the importer be importing the column headers?  And second, why would less than 200 of the 12,000 records import and ALL the rest fail on the very same error, the duplicate user name (which is the column header)?

     

    I am running the latest version, 2.5.3.

    My client is freaking out, any help would be most appreciated.

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Nov 07, 2014 @ 16:14
    Richard Soeteman
    0

    Hi Mike,

    When strange things happen with xlsx files it's most likely because the contain formatting. Copy the sheet into a new sheet and only copy data and now data and use that one to import again.

    Sorry for your client freaking out..

    Best,

    Richard

  • MikeD 92 posts 112 karma points
    Nov 07, 2014 @ 17:06
    MikeD
    0

    Thanks for the quick reply Richard.  I'll try it and let you know.

Please Sign in or register to post replies

Write your reply to:

Draft