Copied to clipboard

Flag this post as spam?

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


  • Murray Roke 503 posts 966 karma points c-trib
    May 12, 2014 @ 09:41
    Murray Roke
    0

    Importing blank usernames

    Hi
    I'm getting a bunch of these errors when importing members:

    Error while importing data for property '', datasource record Login = '', Error :The username of a Member must be different from an emptry string Parameter name: loginName
    Error while importing data for property 'subsSubscriberComments', datasource record Login = '', Error :The username of a Member must be different from an emptry string Parameter name: loginName

    (NB: there's a typo "emptry")

    Is there a way to bypass this error and import the records anyway (I've just exported them from an old umbraco database so it's valid.)

  • Richard Soeteman 4035 posts 12842 karma points MVP
    May 12, 2014 @ 09:47
    Richard Soeteman
    0

    The typo will be fixed but it can't import empty values on login. Strange that you have those in the old DB. Maybe you can use some event code to use email address when login is empty?

    Best,

    Richard

  • Murray Roke 503 posts 966 karma points c-trib
    May 13, 2014 @ 00:19
    Murray Roke
    0

    Here's what I tried,
    However the breakpoint is never hit, is there an earlier event I should use? it seems the record is already rejected before the event fires?

    (Note: a breakpoint earlier in the method does get triggered and shows a valid record which was successfully imported)

    public class MemberImportEventHandlers : ApplicationBase
    {
        public MemberImportEventHandlers()
        {
            MemberImport.RecordImporting += new MemberImport.RecordImportingEventHandler(MemberImport_RecordImporting); 
        }
    
        private void MemberImport_RecordImporting(object sender, RecordImportingEventArgs e)
        {
            var member = sender as Member;
            if (member == null)
            {
                return;
            }
    
            if (string.IsNullOrWhiteSpace(e.Items["Login"].ToString()))
            {
                member.LoginName = "_" + e.Items["Name"]; // <------- breakpoint here.
            }
    
        }
    }
    
  • Richard Soeteman 4035 posts 12842 karma points MVP
    May 13, 2014 @ 07:27
    Richard Soeteman
    0

    Did you already tried moving the breakpoint up?

  • Murray Roke 503 posts 966 karma points c-trib
    May 13, 2014 @ 22:38
    Murray Roke
    0

    yep,
    I can break into the if clause above and see every 'Login' come through except all the ones where it is blank.

  • Richard Soeteman 4035 posts 12842 karma points MVP
    May 14, 2014 @ 08:29
    Richard Soeteman
    0

    I have a clue why this is happening. The record isn't imported because the login name is empty so this event is never fired.

    Easiest thing to do is to fix the file just update the blanks values with the value you want to use when the login is empty. A bit harder is to create a custom Data Adapter that overides from the CSV Data Adapter and in the GetData method you set the value like you would have done in the event.

    Best,

    Richard

Please Sign in or register to post replies

Write your reply to:

Draft