Forum
Günlük olarak bir forma girilen tüm verileri excel formatında export etmek istiyorum.
Bir kod parçası bulabildim fakat çalıştırmakta pek başarılı olamadım.
Bu tarz bir scripti nereden bulabilirim?
$MyWeb = Get-SPWeb "http://sp/Lists"
$MyList = $MyWeb.Lists["Siparis Takibi"]
$exportlist = @()
$Mylist.Items | foreach {
$obj = New-Object PSObject -Property @{
“Column1” = $_["Kimlik"]
"Column2" = $_["Sipariş No"]
"Column3" = $_["Sipariş Tarihi"]
"Column4" = $_["XX1"]
"Column5" = $_["XX2"]
"Column6" = $_["XX3"]
"Column7" = $_["XX4"]
"Column8" = $_["XX5"]
"Column9" = $_["Oluşturan"]
}
$exportlist += $obj
$exportlist | Export-Csv -path 'C:\keygen\Filename.csv'
}
İlgili listenizde excele aktarı seçseniz, daha sonra bu excel ile sp listiniz bağlı kalacağı için bu exceli sadece yenile diyerek güncelleseniz daha net bir çözüm olabilir.
http://sharepointpsscripts.codeplex.com/releases/view/21696
ilk scripti indirdim..
Bilgilerimi girdikten sonra ise aşağıdaki hatayı almaktayım.
Link olarak ne yazarsam yazayım aynı şekilde could not be found diyor.
PS E:\exportscript> .\Export-Import-SharePoint-List.ps1
New-Object : Exception calling ".ctor" with "1" argument(s): "The Web application at http://info-point/IT/Wiki/Forms/Al
lPages.aspx could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing con
tent, the system administrator may need to add a new request URL mapping to the intended application."
At E:\exportscript\Export-Import-SharePoint-List.ps1:20 char:20
+ $site = new-object <<<< Microsoft.SharePoint.SPSite($ListURL)
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
ListURL http://info-point/IT/Wiki/Forms/AllPages.aspx
You cannot call a method on a null-valued expression.
At E:\exportscript\Export-Import-SharePoint-List.ps1:23 char:22
+ $web = $site.OpenWeb <<<< ()
+ CategoryInfo : InvalidOperation: (OpenWeb:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At E:\exportscript\Export-Import-SharePoint-List.ps1:24 char:22
+ $list = $web.GetList <<<< ($ListURL)
+ CategoryInfo : InvalidOperation: (GetList:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Exception setting "SiteUrl": "Invalid URI: The URI is empty."
At E:\exportscript\Export-Import-SharePoint-List.ps1:26 char:12
+ $settings. <<<< SiteUrl = $web.Url
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
Exception setting "Id": "Cannot convert null to type "System.Guid"."
At E:\exportscript\Export-Import-SharePoint-List.ps1:27 char:16
+ $exportObject. <<<< Id = $list.ID
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
You cannot call a method on a null-valued expression.
At E:\exportscript\Export-Import-SharePoint-List.ps1:29 char:59
+ $settings.BaseFileName = "ExportList-"+ $list.ID.ToString <<<< () +".DAT"
+ CategoryInfo : InvalidOperation: (ToString:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
FileLocation E:\ExportScript\xls\
Exception calling "Add" with "1" argument(s): "The URL property of SPExportObject object cannot have a null or empty st
ring value if the Id is not specified."
At E:\exportscript\Export-Import-SharePoint-List.ps1:34 char:29
+ $settings.ExportObjects.Add <<<< ($exportObject)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Exception calling "Run" with "0" argument(s): "The SiteUrl property of SPDeploymentSettings object cannot have a null o
r empty string value."
At E:\exportscript\Export-Import-SharePoint-List.ps1:37 char:13
+ $export.Run <<<< ()
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
You cannot call a method on a null-valued expression.
At E:\exportscript\Export-Import-SharePoint-List.ps1:39 char:14
+ $web.Dispose <<<< ()
+ CategoryInfo : InvalidOperation: (Dispose:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At E:\exportscript\Export-Import-SharePoint-List.ps1:40 char:15
+ $site.Dispose <<<< ()
+ CategoryInfo : InvalidOperation: (Dispose:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
PS E:\exportscript> http://sharepointpsscripts.codeplex.com/releases/view/21696
http://roxority.com/exportzen-download/
Bu sitedeki solution ile excele muhtaç olmadan sorun çözüldü 🙂