如何将数据表复制到 SharePoint SPList?
我的源列表数据位于 sourceList
数据表中,并且希望将该数据复制到其根列表。
我怎样才能做到这一点?
private void MoveToTopTaskList(DataTable sourceList, SPSite DestinationSiteCollection)
{
SPWeb Destinationsite = DestinationSiteCollection.OpenWeb();
SPList DestinationList = Destinationsite.Lists[TASKS];
SPListItem DestinationListItem = DestinationList.Items.Add();
foreach (DataRow row in sourceList.Rows)
{
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
上述情况的最佳方法是使用 SPWeb 对象的 ProcessBatchData 方法。 这将帮助您将列表项批量更新到列表中。
如果您想使用 OM 来执行此操作, 。 然后按照代码
`
[1]:https://learn.microsoft.com/en-us/previous-versions/office/developer/sharepoint-services/cc404818%28v=office.12%29
[2]:https://web.archive.org/web/20121029142042/http://blog.dynatrace.com:80/2009/01/20/sharepoint-using -批量更新以加速性能/
Best Approach for the above case is to Use the ProcessBatchData Method of the SPWeb Object. This will help you to update List items in to the List in Batch.
In case if you want to do it using the OM. Then follow code
`
[1]:https://learn.microsoft.com/en-us/previous-versions/office/developer/sharepoint-services/cc404818%28v=office.12%29
[2]:http://www.sharepointblogs.com/smc750/archive/2008/04/03/spweb-processbatchdata-a-list-is-a-list-is-a-list.aspx
[3]:https://web.archive.org/web/20121029142042/http://blog.dynatrace.com:80/2009/01/20/sharepoint-using-batch-updates-to-speed-up-performance/