简体   繁体   English

使用 Powershell 将 Prem 上 SQL 服务器上的数据添加到 SharePoint 列表

[英]Adding data from SQL server on Prem to SharePoint List using Powershell

I am getting an error when running the PowerShell script.运行 PowerShell 脚本时出现错误。 Error is related to a missing assembly.错误与缺少的程序集有关。 Script will get the data from the SQL server and query through each item in the SharePoint list and update the values if any changes.脚本将从 SQL 服务器获取数据,并通过 SharePoint 列表中的每个项目进行查询,如果有任何更改,则更新值。

I tried adding libraries in the PowerShell code but I am getting the same error.我尝试在 PowerShell 代码中添加库,但我得到了同样的错误。

GAC    Version        Location
---    -------        --------
True   v4.0.30319     C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.SharePoint.Client\v4.0_16.0.0.0__71e9bce111e9429c...
True   v4.0.30319     C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.SharePoint.Client.Runtime\v4.0_16.0.0.0__71e9bce1...
Enter password: ************
5
Data Import Starts...

New-Object: Cannot find type [Microsoft.SharePoint.SPQuery]: verify that the assembly containing this type is loaded.新对象:找不到类型 [Microsoft.SharePoint.SPQuery]:验证是否已加载包含此类型的程序集。 At C:\SQL Server\SQLSharepointLoad.ps1:55 char:16 + $SPQuery = New-Object Microsoft.SharePoint.SPQuery + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo: InvalidType: (:) [New-Object], PSArgumentException + FullyQualifiedErrorId: TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand在 C:\SQL Server\SQLSharepointLoad.ps1:55 char:16 + $SPQuery = 新对象 Microsoft.SharePoint.SPQuery + ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~ + CategoryInfo: InvalidType: (:) [New-Object], PSArgumentException + FullyQualifiedErrorId: TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

The property 'Query' cannot be found on this object.在此 object 上找不到属性“查询”。 Verify that the property exists and can be set.验证该属性是否存在并且可以设置。 At C:\SQL Server\SQLSharepointLoad.ps1:56 char:5 + $SPQuery.Query = "在 C:\SQL Server\SQLSharepointLoad.ps1:56 char:5 + $SPQuery.Query = "

If you want to get data from SQL Server, you could use SQL Server PowerShell, check below thread.如果你想从 SQL 服务器获取数据,你可以使用 SQL 服务器 PowerShell,检查下面的线程。

Using Powershell get Values from sql table 使用 Powershell 从 sql 表中获取值

If you want to get data from SharePoint, I do suggest you use CSOM to query SharePoint list data(SPQuery is SSOM which can be run in SharePoint server).如果你想从 SharePoint 获取数据,我建议你使用 CSOM 来查询 SharePoint 列表数据(SPQuery 是 SSOM,可以在 Z97F02F6993B93732B0D39DFE004699 服务器上运行)。

You could get CSOM SDK from您可以从

2013 2013

https://www.microsoft.com/en-us/download/details.aspx?id=35585 https://www.microsoft.com/en-us/download/details.aspx?id=35585

2016 2016 年

https://www.microsoft.com/en-us/download/details.aspx?id=51679 https://www.microsoft.com/en-us/download/details.aspx?id=51679

Sample PowerShell to connect SharePoint by PowerShell with CSOM.样品 PowerShell 通过 PowerShell 与 CSOM 连接 SharePoint。

https://social.technet.microsoft.com/Forums/office/en-US/e7894793-4d6f-4184-af2e-2ba685d6c90a/csom-powershell-and-sharepoint-2010-to-read-all-sites-subsites-libs-and-lists?forum=sharepointgeneralprevious https://social.technet.microsoft.com/Forums/office/en-US/e7894793-4d6f-4184-af2e-2ba685d6c90a/csom-powershell-and-sharepoint-2010-to-read-all-sites-subsites- libs-and-lists?forum=sharepointgeneralprevious

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 PowerShell CSOM 从 SharePoint On-Prem 获取所有 Web 应用程序 - Get All Web Applications from SharePoint On-Prem using PowerShell CSOM Powershell:使用 REST API 从 Sharepoint 列表中删除项目 - 远程服务器返回错误:(400) 错误请求 - Powershell: Using REST API to Delete Items from a Sharepoint List - The remote server returned an error: (400) Bad Request 如何使用 powershell cmdlet 在 prem 上获取 Exchange 服务器的电子邮件正文 - how to get email body for exchange server on prem using powershell cmdlet 无法从SQL Server代理作业运行sharepoint Powershell脚本 - unable to run sharepoint powershell script from sql server agent job 使用PowerShell无法在SharePoint服务器上验证和下载Word文档列表 - Inability to authenticate and download the list of Word documents at SharePoint server by using PowerShell 使用PowerShell通过SOAP将数据从SQL Server发送到服务 - Using PowerShell to send data from SQL Server to service via SOAP 如何使用 PowerShell 从 SQL Server 中的 .csv 导入数据? - How to import data from .csv in SQL Server using PowerShell? 如何使用 PowerShell 将数据从 SQL 服务器添加到哈希表? - How to add data from SQL server to hashtable using PowerShell? 使用Powershell将数据从SQL Server数据库导入CSV - Import data from SQL Server database to CSV using Powershell Powershell Sharepoint Online - 将内容类型添加到列表 - Powershell Sharepoint Online - Adding a content type to a list
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM