zoukankan      html  css  js  c++  java
  • 在PowerShell中操作SharePoint对象

    1. 用PowerShell创建一个SharePoint内容对象
    创建一个自定义列表:
    $SPSite = New-Object Microsoft.SharePoint.SPSite("http://inno"); $OpenWeb = $SpSite.OpenWeb(); $TemplateType = $OpenWeb.ListTemplates["自定义列表"]; $OpenWeb.Lists.Add("My Custom List2","Description Of My Custom List",$TemplateType); $OpenWeb.Dispose(); $SPSite.Dispose()

    2. 用PowerShell列出站点所有Content模板
    $SPSite = New-Object Microsoft.SharePoint.SPSite("http://inno"); $OpenWeb = $SpSite.OpenWeb(); $OpenWeb.ListTemplates | Select Name, Description; $OpenWeb.Dispose(); $SPSite.Dispose()

    3. 如何用PowerShell导出/备份SharePoint站点
    You need something like this:
    Get-SPWeb -site http://sp2010  | ForEach-Object { $filename = $_.Url.replace("http://","").replace("-","--").replace("/","-") + ".export" ; Write-Host export-spweb $_ -path $filename}
    That will walk through all the webs under sp2010, remove the "http://" at the beginning, replace all the dashes with doubledashes, and the slashes with dashes. Then exports them. That way something like http://sp2010/sites/test/foo-bar will be savesd as sites-test-foo--bar.export.
    Oh, and you'll have to remove the "write-host" for it to actually work. I put that in as a safety measure. :)

  • 相关阅读:
    Celery详解
    JWT详解
    进程及进程池
    多线程详解
    python常用模块之os模块的用法
    python常用模块之paramiko与ssh
    reflect 反射
    http 静态文件
    模板渲染语言
    http web 开发
  • 原文地址:https://www.cnblogs.com/jancco/p/2489074.html
Copyright © 2011-2022 走看看