自动将数据从 SP2010 外部列表复制到 SP2010 自定义列表

发布于 2024-11-02 17:41:26 字数 145 浏览 7 评论 0原文

我有一个 SP 2010 外部列表,其中填充了客户名称。该列表全天偶尔更新。我想在更新时或在设定的时间(每小时)将新添加的名称自动复制到另一个 SP 2010 列表。

有没有简单的方法可以做到这一点?如果没有,至少有办法做到吗?

感谢您的帮助。

I have an SP 2010 external list that is populated with customer names. The list is updated occasionally throughout the day. I would like to automatically copy the newly added names to another SP 2010 list when it is updated or at a set time (hourly).

Is there an easy way to do this? And if not, is there at least a way to do it?

Thank you for your help.

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

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

发布评论

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

评论(5

⒈起吃苦の倖褔 2024-11-09 17:41:26

不幸的是,外部列表不支持工作流程。所以工作流程不是这里的解决方案。

执行此操作的方法之一是创建自定义计时器作业来同步项目和项目。配置为定期运行它。查看有关如何创建和创建的详细信息此处注册自定义作业。

但这种方法有其自身的缺点:

  1. 它足够复杂,
  2. 您将需要一个农场范围的功能+
    接收者注册该作业。这
    原因是出于安全目的
    您无法注册自定义职位
    在 Content 中运行的代码中
    Web应用程序(所以它不会工作
    网站集级别功能
    接收器),仅来自运行的代码
    中央管理应用程序。

Unfortunately, External Lists do not support workflows. So workflow is not a solution here.

One of the way to do this would be to create a custom timer job to synchronize items & configure to run it periodically. See details about how to create & register custom job here.

But this approach has it's own drawbacks:

  1. it is complex enough
  2. you will need a farm scoped feature +
    receiver to register the job. The
    reason is that for security purposes
    you can't register a custom job from
    within the code running in Content
    Web application (so it will not work
    in site collection level feature
    receiver), only from code running in
    Central Admin app.
熊抱啵儿 2024-11-09 17:41:26

我会在 SharePoint 中构建 Windows 服务或定时作业,然后将兼容的 ado.net 连接器连接到我的进程。通过这种方式,您可以在两个列表之间复制或同步数据,就像它们在普通 SQL 表中一样。

private void example()
{    
    // Fetch data from your left sharepoint
    SharePointConnection leftConnection = new SharePointConnection(@"
        Server=mysharepointserver.com;
        Database=mysite/subsite
        User=spuser;
        Password=******;
        Authentication=Ntlm;
        TimeOut=10;
        StrictMode=True;
        RecursiveMode=RecursiveAll;
        DefaultLimit=1000;
        CacheTimeout=5");

    leftConnection.Open();

    string leftQuery = "SELECT * FROM LeftList";
    SharePointDataAdapter adapter = new SharePointDataAdapter(leftQuery, leftConnection);

    DataTable dt = new DataTable();
    adapter.Fill(dt);


    // Insert data in right sharepoint
    SharePointConnection rightConnection = new SharePointConnection(@"
        Server=anothersharepointserver.com;
        Database=whateversite
        User=spuser;
        Password=******;
        Authentication=Ntlm;
        TimeOut=10;
        StrictMode=True;
        RecursiveMode=RecursiveAll;
        DefaultLimit=1000;
        CacheTimeout=5");

    rightConnection.Open();

    // build your rightQuery here
    string rightQuery = "Insert into"...

    SharePointCommand command = new SharePointCommand(rightQuery, rightConnection);
    command.ExecuteNonQuery();

}

您可以尝试这个 http://www.bendsoft.com/net-sharepoint-connector/< /a>.这个 ado.net 连接器使用 SharePoint 的 API,因此您可以在第三台计算机上运行该服务,只要它具有访问权限就可以了。

http://blog.bendsoft.com 上有一些示例和操作方法

I'd build a windows service or a timed job in SharePoint and then hook up a compatible ado.net connector to my process. This way you can copy or synchronize data between your two lists as if they where ordinary SQL tables.

private void example()
{    
    // Fetch data from your left sharepoint
    SharePointConnection leftConnection = new SharePointConnection(@"
        Server=mysharepointserver.com;
        Database=mysite/subsite
        User=spuser;
        Password=******;
        Authentication=Ntlm;
        TimeOut=10;
        StrictMode=True;
        RecursiveMode=RecursiveAll;
        DefaultLimit=1000;
        CacheTimeout=5");

    leftConnection.Open();

    string leftQuery = "SELECT * FROM LeftList";
    SharePointDataAdapter adapter = new SharePointDataAdapter(leftQuery, leftConnection);

    DataTable dt = new DataTable();
    adapter.Fill(dt);


    // Insert data in right sharepoint
    SharePointConnection rightConnection = new SharePointConnection(@"
        Server=anothersharepointserver.com;
        Database=whateversite
        User=spuser;
        Password=******;
        Authentication=Ntlm;
        TimeOut=10;
        StrictMode=True;
        RecursiveMode=RecursiveAll;
        DefaultLimit=1000;
        CacheTimeout=5");

    rightConnection.Open();

    // build your rightQuery here
    string rightQuery = "Insert into"...

    SharePointCommand command = new SharePointCommand(rightQuery, rightConnection);
    command.ExecuteNonQuery();

}

You could try this one http://www.bendsoft.com/net-sharepoint-connector/. This ado.net connector uses the API of SharePoint so you can run the service in a third machine and as long as it has access you'll be fine.

There are some examples and howto's at http://blog.bendsoft.com

你如我软肋 2024-11-09 17:41:26

可以为此轻松创建工作流程。当新创建或更新项目时可以触发工作流。工作流程可以将相同的项目创建到另一个列表中。

尝试使用 SharePoint 设计器创建工作流,该设计器非常简单直接。

希望这有帮助。 :)

A workflow can be created for this easily. The workflow can be triggered when an item is newly created or updated. The workflow can create the same item into another list.

Try creating the workflow using SharePoint designer, which is quiet straight forward.

Hope this helps. :)

抠脚大汉 2024-11-09 17:41:26

为什么要将外部数据复制到另一个列表?这样做的目的是什么?也许对于您正在尝试做的事情有更好的解决方案。

我之所以这么说,是因为您将要复制数据,这可能会有点棘手,特别是如果您允许在两个地方都更新数据的话。

Why do you want to copy the external data to another list? What is the purpose of doing this? Perhaps there is a better solution for what you are trying to do.

The reason I say this, is because you are going to be replicating data and could get a bit tricky, especially if you allow the data to be updated in both places.

月隐月明月朦胧 2024-11-09 17:41:26

我会使用 MS Access 将数据从一个表中复制出来,然后将其推送到另一个表中。我广泛使用了 Access/Sharepoint,它有点问题......但它通常可以工作。它可能会崩溃 - 但对于 90% 的小表,你可以做到这一点!

I'd use MS access in order to copy data out of one table, and push it into another table. I've used Access/Sharepoint extensively, and it's a little bit buggy.. but it generally works. It might crash- but for 90% of small tables, heck yes you can do this!

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