【问题标题】:Programmatically export a SharePoint Online list Daily每天以编程方式导出 SharePoint Online 列表
【发布时间】:2015-12-04 23:31:06
【问题描述】:

我已经从事 SharePoint 几年了,这个看似简单的任务让我感到难过。我想自动导出列表,以便它在每天结束时运行并将报告通过电子邮件发送给我。这是在 O365 中,所以我不能只是在服务器上放一些 PowerShell,从任务计划程序中的 bat 文件中调用它并完成。

我看到有人提到构建 .aspx 页面并使用 Javascript/REST 生成报告,这很好,但我不知道如何每天自动通过电子邮件发送。

我使用过 SharePoint Online 命令行管理程序,但不知道如何将列表数据拉入。

有人能指出我正确的方向吗?谢谢!

【问题讨论】:

  • 您可以通过 CSOM 使用 Microsoft.SharePoint.Client 轻松完成此操作,并在组织内的主机上运行它。我通常通过 C# 执行此操作,但它在 PowerShell 中工作得很好。

标签: sharepoint office365 sharepoint-workflow powershell-ise


【解决方案1】:

您可以使用 Microsoft.SharePoint.Client 通过 CSOM 轻松完成此操作,并在组织内的主机上运行它。我通常通过 C# 执行此操作,但它在 PowerShell 中工作得很好,我借用了元代码:http://sharepointryan.com/2014/03/07/return-splistitems-using-csom-and-powershell-without-writing-caml/

$GLOBAL:Context = New-Object Microsoft.SharePoint.Client.ClientContext("http://Your.O365Url")
$GLOBAL:Credentials = Get-Credential -UserName $EmailAddress -Message "Office 365 Password"
$Context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Credentials.UserName,$Credentials.Password)
$GLOBAL:Web = $GLOBAL:Context.Web
$GLOBAL:Context.Load($GLOBAL:Web)
$GLOBAL:Context.ExecuteQuery()

$list = $GLOBAL:Web.Lists.GetByTitle("ListOfItems")
$items = $list.GetItems()
$GLOBAL:Context.Load($items)
$GLOBAL:Context.ExecuteQuery()

只要您安装了库,CSOM 就可以在任何地方工作。

【讨论】:

  • 谢谢阿肯!这正是我想要的。
  • 乐于助人。 CSOM 是救命稻草。
猜你喜欢
  • 1970-01-01
  • 2018-11-13
  • 1970-01-01
  • 2014-01-04
  • 2013-11-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-02-12
相关资源
最近更新 更多