zoukankan      html  css  js  c++  java
  • 深入浅出SharePoint——使用PowerShell导出站点的导航

    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
    function ExportQuickLaunchNavigation(
        [Microsoft.SharePoint.SPWeb] $web)
    {
        $xml = [xml] "<QuickLaunch/>"
    
        foreach ($navigationNode in $web.Navigation.QuickLaunch)
        {
            AddNavigationElement $navigationNode $xml.DocumentElement
        }
    
        return $xml
    }
    
    function AddNavigationElement(
        [Microsoft.SharePoint.Navigation.SPNavigationNode] $navigationNode,
        [System.Xml.XmlElement] $parentElement)
    {
        $navElement = $parentElement.OwnerDocument.CreateElement("NavigationNode")
    
        $parentElement.AppendChild($navElement) > $null
    
        $navElement.SetAttribute("title", $navigationNode.Title)
        $navElement.SetAttribute("url", $navigationNode.Url)
    
        foreach ($childNode in $navigationNode.Children)
        {
            AddNavigationElement $childNode $navElement
        }
    }
    
    $webUrl="http://cris-moss/sites/Mockup/";
    $null = [System.Reflection.Assembly]::LoadFrom("C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI\Microsoft.SharePoint.dll")
    $site =  New-Object -TypeName "Microsoft.SharePoint.SPSite" -ArgumentList "$webUrl";
    $web = $site.OpenWeb()
    
    $navigationXml = ExportQuickLaunchNavigation($web)
    
    $navigationXml.OuterXml
    

      

  • 相关阅读:
    c#设计模式(1)——单例模式
    Javascript变量
    悲观锁和乐观锁
    NestJs 环境 配置
    分布式查询
    Git hub 忽略 文件 、文件夹
    ES6 基础 二
    ES6 基础 一
    invalid credential, access_token is invalid or not latest hint(微信 上传图片返回 error)
    nodejs 入门一(环境及插件)
  • 原文地址:https://www.cnblogs.com/mingle/p/3010123.html
Copyright © 2011-2022 走看看