SharePoint 文档库 - 更改“文档创建者”场地

发布于 2024-09-03 15:22:46 字数 203 浏览 0 评论 0原文

我有一个代码可以更改各种 SharePoint 列表中的用户名,主要是通过“作者”列。它在普通列表上一切正常,但在作为文档库的“共享文档”列表上似乎不起作用。

无论我更改“创建者”还是“文档创建者”中的用户名,更改似乎都没有生效。 item.Update 命令不会引发任何异常,但它显然不会更新字段。

如果我想通过代码改变这个字段怎么办?

谢谢

I have a code that changes the username in various SharePoint lists, mostly by the "Author" column. It all works fine on normal lists, but it doesn't seem to work on the "Shared Documents" list which is a document library.

Whether I change the username in "Created By" or "Document Created By", the change doesn't seem to take effect. The item.Update command doesn't throw any exception, but it clearly doesn't update the field(s).

What can I do if I want to change this field through code?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

め七分饶幸 2024-09-10 15:22:46

我找到了解决我的问题的方法。

只有我试图更新的最后一个字段被“覆盖”。

因此,虽然下面的代码不起作用:

item["Author"] = 22;

item.SystemUpdate();

但这个可以:

item["Author"] = 22;

item["Modified By"] = item["Modified By"]; //Or any other field 

item.SystemUpdate();

I found a workaround for my problem.

Only the last field I'm trying to update is being "overwritten".

So, while the following code won't work:

item["Author"] = 22;

item.SystemUpdate();

This one will do:

item["Author"] = 22;

item["Modified By"] = item["Modified By"]; //Or any other field 

item.SystemUpdate();
我要还你自由 2024-09-10 15:22:46

也许这可以帮助 如何更改“Created By”的值...

注意AllowUnsafeUpdates 属性。

Maybe this could help How to change the value of "Created By"...

Pay attention on AllowUnsafeUpdates property.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文