2

We can access SDL Tridion User details through the UserData object, but can we also create Users and assign Roles using Core Services in 2011?

1
  • Yes - of course you can. If you have tried this and had trouble, please let us know what you tried and what the problems were. Commented Aug 13, 2013 at 6:51

1 Answer 1

8

Of course you can:

var user = (UserData) ClientAdmin.GetDefaultData(ItemType.User, null, new ReadOptions());
user.Title = "domain\\user";
user.Description = "My new user";

user.GroupMemberships = new[]
{
    new GroupMembershipData
    {
        Group = new LinkToGroupData {IdRef = groupId},
        Scope = new[]
        {
            new LinkWithIsEditableToRepositoryData { IdRef = publication1Id },
            new LinkWithIsEditableToRepositoryData { IdRef = publication2Id },
        }
    },
};
user = (UserData) ClientAdmin.Create(user, new ReadOptions());

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.