【发布时间】:2014-02-04 05:57:38
【问题描述】:
我正在尝试在共享点列表中输入一些数据,但外壳无法识别共享点应用程序的 url,尽管当我正在执行 Get-SPWebApplication |选择显示名称、URL 我可以看到我正在输入的实例。 这是我得到的错误:
这是我要执行的脚本:
#--------------------------------------------------------------------
# Name: Load CSV into SharePoint List
# NOTE: No warranty is expressed or implied by this code – use it at your
# own risk. If it doesn't work or breaks anything you are on your own
#--------------------------------------------------------------------
# Setup the correct modules for SharePoint Manipulation
if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
Add-PsSnapin Microsoft.SharePoint.PowerShell
}
$host.Runspace.ThreadOptions = "ReuseThread"
#Open SharePoint List
$SPServer=http://win-pdp84ekkhr7/
$SPAppList="/Lists/Application List/"
$spWeb = Get-SPWeb $SPServer
$spData = $spWeb.GetList($SPAppList)
$InvFile="test.csv"
# Get Data from Inventory CSV File
$FileExists = (Test-Path $InvFile -PathType Leaf)
if ($FileExists) {
"Loading $InvFile for processing..."
$tblData = Import-CSV $InvFile
} else {
"$InvFile not found - stopping import!"
exit
}
# Loop through Applications add each one to SharePoint
"Uploading data to SharePoint...."
foreach ($row in $tblData)
{
"Adding entry for "+$row."Application Name".ToString()
$spItem = $spData.AddItem()
$spItem["Application Name"] = $row."Application Name".ToString()
$spItem["Application Vendor"] = $row."Application Vendor".ToString()
$spItem["Application Version"] = $row."Application Version".ToString()
$spItem["Install Count"] = $row."Install Count".ToString()
$spItem.Update()
}
"---------------"
"Upload Complete"
$spWeb.Dispose()
我不知道我是否需要配置一些权限,每个建议都会受到欢迎。 谢谢,Laziale
【问题讨论】:
-
改变这个,看看会发生什么: $SPServer="win-pdp84ekkhr7" 基本上是把 url 用双引号括起来。
-
这对我有帮助,如果您可以将其发布为答案,我会将其标记为正确答案。谢谢!
标签: sharepoint powershell sharepoint-2010 windows-server-2008 powershell-2.0