如何在 Sharepoint 2010 中将用户字段设置为当前通过 XML 登录的用户的默认值? [英] How can I set a User field to a default value of a user currently logged in through XML in Sharepoint 2010?

查看:36
本文介绍了如何在 Sharepoint 2010 中将用户字段设置为当前通过 XML 登录的用户的默认值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 XML 中为用户类型的字段创建字段定义,并且需要将其默认值设置为当前登录的用户.我该怎么做?

I'm trying to create an field definition in XML for a field of a User type and need to set its default value to a user currently logged in. How do I do that?

非常感谢.

推荐答案

这是我最近的一次:

<Field ID="{99ced9dc-5715-47a7-9ede-1733f027eeb4}" 
    Name="MyField" 
    DisplayName="My Field" 
    Type="User" 
    List="UserInfo" 
    UserSelectionMode="PeopleOnly" 
    Required="TRUE">
    <DefaultFormula>=";#"&amp;Me</DefaultFormula>
</Field>

它不会爆炸,但它也没有给出预期的结果.问题是 Me 会给出用户的名字,但由于 用户字段 是一种特殊类型的 查找字段,名称被忽略.所需要的只是 ID,但我找不到任何能给我带来价值的东西.

It doesn't blow up, but it doesn't give the desired result either. The problem is that Me will give the name of the user, but since the User Field is a special type of Lookup Field, the name is ignored. All that is needed is the ID, but I haven't been able to find anything that will give me that value.

以下是一些可能的解决方法:

Here are some possible workarounds:

这篇关于如何在 Sharepoint 2010 中将用户字段设置为当前通过 XML 登录的用户的默认值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆