SharePoint 2013-业务连接服务-在“作者/编辑者"字段中保存当前用户 [英] SharePoint 2013 - Business Connectivity Services - Save Current User in Author/Editor Fields

查看:81
本文介绍了SharePoint 2013-业务连接服务-在“作者/编辑者"字段中保存当前用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用SharePoint Business Connectivity Services填充和更改SQL表中的内容.这里有个小例子.我创建了一个外部ContentType";与该SQL表的连接:

I want to use the SharePoint Business Connectivity Services to fill and Change the Content in SQL tables. Here a little example. I have created an "External ContentType" with a connection to this SQL table:

作者", 创建",修改"和编辑器"没有连接到适当的SQL表列(InsertBy,InsertDate,EditBy和EditDate).

As you can see, the SharePoint standard fields "Author", "Created", "Modified" and "Editor" are not connected to appropriated SQL Table Columns (InsertBy, InsertDate, EditBy and EditDate).

I also like to fill the SQL Columns "InsertBy", and "UpdateBy" automaticly with the current SharePoint user.

So my two questions are:

作者", 创建",修改"和编辑器"到指定的SQL列?

- How can I connect the SharePoint Default fields "Author", "Created", "Modified" and "Editor" to the specified SQL Columns?

- How can I fill automaticly this fields by the current SharePoint User.

提前谢谢

多米尼克

推荐答案

对于外部列表,这些字段将为空,因为数据未存储在SharePoint中.

These fields will be empty for an external list because the data is not stored in SharePoint.

很难将SharePoint默认字段连接到sql字段.

作为一种解决方法,我们可以将字段设置为只读,并使用当前日期自动填充这些字段和当前的用户信息(使用脚本).

这里是一个脚本示例,该脚本示例使用以下命令使用当前用户名自动填充字段值 SPServices.SPGetCurrentUser 方法:

Here is a script example which is used to auto-fill field value with the current user name using SPServices.SPGetCurrentUser method:

<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.02/jquery.SPServices-2014.02.min.js" type="text/javascript"></script>

<script type="text/javascript">


(document).ready(function(){
(document).ready(function() {


("input [ Title ='<字段标题>']').val(
("input[Title='<field title>']").val(


这篇关于SharePoint 2013-业务连接服务-在“作者/编辑者"字段中保存当前用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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