cancel
Showing results for 
Search instead for 
Did you mean: 

Error creating MDM user with .Net API

Former Member
0 Kudos

Below is the .net code i am using to try to create an MDM user. On the cmd.execute(); I get this error below.

Does the code look correct? Any ideas on the error?

Also, of note, UserId uid = cmd.getNewUserId(); returns null, so I'm not setting it.

ERROR:

InnerException: com.sap.mdm.intern.protocol.manual.ServerException

Message="MDM repository data is out-of-date or is locked by another MDM Server. Refresh the data and try the operation again. If the error persists, contact the system administrator. [0xffab4128]"

Source="MdmDotNetApi"

ErrorCode=-5553880

StackTrace:

at com.sap.mdm.intern.protocol.manual.AbstractProtocolCommand.execute(PassportSupport passportSupport)

at com.sap.mdm.security.commands.CreateUserCommand.execute()

CODE:


            RepositorySessionContext repSessionCtx = new RepositorySessionContext("SERVER", "REPOSITORY", "USERID");

            UserSessionContext UserSessionCtx = new UserSessionContext("SERVER", "REPOSITORY", "USERID");            
            UserSessionCtx.ApplicationName = "APPLICATION";

            string repsessiontext = SessionManager.Instance.createSession(repSessionCtx, SessionTypes.REPOSITORY_SESSION_TYPE, "PASSWORD");
            
            CreateUserCommand cmd = new CreateUserCommand(repSessionCtx);
            cmd.Session = repsessiontext;

            cmd.User = new UserProperties();

            UserId uid = cmd.getNewUserId();

            //cmd.User.Id = uid;
            cmd.User.Description = "Test";
            cmd.User.Emails = new String[1] {"TestATtest.com"};
            cmd.User.FullName = "TEST TEST";
            cmd.User.Locked = false;
            cmd.User.Name = "TEST";
            cmd.User.PasswordChangeRequired = false;
            cmd.User.PasswordNeverExpires = true;
            cmd.User.setPassword("asdf1234!@#$");

            cmd.InChangeStamp = -1;

            cmd.execute();

Edited by: Wardell Castles on Jul 27, 2010 5:44 PM - was missing this line 'cmd.Session = repsessiontext;'

View Entire Topic
Former Member
0 Kudos

Hi,

I think the problem is with...


cmd.InChangeStamp = -1;

Try doing this...


GetUserListCommand userListCmd = new GetUserListCommand(repSessionCtx);
userListCmd.execute();

cmd.InChangeStamp = userListCmd.InChangeStamp;

Hope this will work.

Former Member
0 Kudos

Thank you Shailesh!

That was exactly what was needed.