【问题标题】:How to create a new user in Tridion 2011 using core services?如何使用核心服务在 Tridion 2011 中创建新用户?
【发布时间】:2012-12-30 14:54:23
【问题描述】:

我知道如何创建组件、页面、结构组,但是在使用 .net 的核心服务创建新用户时遇到了困难? 谁能帮我解决这个问题?

【问题讨论】:

  • 对不起,克里斯,这就是问题所在,我找不到任何帮助,我是新手,所以只知道如何创建组件和所有东西

标签: c# tridion tridion-2011


【解决方案1】:

这样的事情应该让你开始:

public void CreateUser(string userName, string friendlyName, bool makeAdministrator)
{
    var defaultReadOptions = new ReadOptions();

    using (var client = GetCoreServiceClient())
    {
        var user = (UserData)client.GetDefaultData(ItemType.User, null);
        user.Title = userName;
        user.Description = friendlyName;
        user.Privileges = makeAdministrator ? 1 : 0;
        client.Create(user, defaultReadOptions);
    }
}

【讨论】:

  • 感谢您的回答彼得,我现在收到此错误:ItemType' is a ambiguous reference between 'Tridion.ContentManager.ItemType' and 'Tridion.ContentManager.CoreService.Client.ItemType
  • 谢谢彼得,它成功了......你能告诉我如何通过用户名获取用户的数据吗:insted of this var user = (UserData)client.GetDefaultData(ItemType.User, null );
  • 您不能通过用户名直接加载用户——您必须使用 TCM URI。如果您真的只有用户名,则需要先获取用户列表才能查找 URI。如果您需要这方面的帮助,请输入一个新问题,因为这是关于创建新用户的问题。
猜你喜欢
  • 2012-03-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-04-11
  • 2012-04-21
  • 2012-09-24
  • 1970-01-01
  • 2012-07-13
相关资源
最近更新 更多