0

I'm trying to create a new user using the CoSign SPML WS.

The code I'm using (C#.NET) is below. Can someone please let me know if the PSOIdentifierType.ID is correct (i.e. "The ID of the User") and what should the Target ID be, I think it should be blank as the user does not exist yet.

private const readonly string addTargetDB = "CoSignDB";
public void CreateBasicUser(string userName, string userLoginName, string userPassword, string userCN, string userEmail)
    {
    SPMLSoapClient client = new SPMLSoapClient();
    AddRequestType request = new AddRequestType();
    PSOIdentifierType psoCreationType = new PSOIdentifierType();
    psoCreationType.ID = userName;
    psoCreationType.targetID = ""; //The parameter that was returned in the ListTargets operation

    UserRecord newUserRecord = new UserRecord();
    newUserRecord.UserLoginName = userLoginName;
    newUserRecord.Password = userPassword;
    newUserRecord.UserCN = userCN;
    newUserRecord.EmailAddress = userEmail;
    newUserRecord.RightsMask = (uint)1; // 1 - User
    newUserRecord.UserKind = UserKindEnum.User;

    request.returnData = ReturnDataType.everything;
    request.targetID = addTargetDB;
    request.psoID = psoCreationType;
    request.UserRecord = newUserRecord;

    AddResponseType clientAddResponse = client.add(request);
    if(clientAddResponse.status == StatusCodeType.success)
        {                
        // OK
        }
    else if(clientAddResponse.status == StatusCodeType.failure)
        {
        // Fail
        }
    }
Jarrod Dixon
  • 15,727
  • 9
  • 60
  • 72
Larry K
  • 47,808
  • 15
  • 87
  • 140

1 Answers1

0

The id of the user is correct (it should be the username) and the TargetID should be "CoSignDB"