zoukankan      html  css  js  c++  java
  • 添加field部署

    Deploy.bat

    View Code
    1 Powershell.exe -Command Set-ExecutionPolicy "Bypass"
    2 Powershell.exe -Command "& {%~dp0InstallMain.ps1}"
    3 Pause

    InstallMain.ps1

    View Code
     1 function UpdateContentTypeChild($sitecollectionurl)
     2 {
     3     $sitecol=Get-SPSite $sitecollectionurl
     4     $rootweb=$sitecol.rootweb
     5 
     6     $spfield=$rootweb.availablecontenttypes["News"].fields["PriorityValue"]
     7 
     8 
     9     $targetweb=Get-SPWeb $sitecollectionurl"/en-US/news"
    10     
    11     
    12     $fieldlink=New-object -typename microsoft.sharepoint.SPFieldlink -argumentlist $spfield
    13     $splist=$targetweb.lists["Pages"]
    14     
    15     $splist.contenttypes["News"].readonly=$false
    16     
    17     $splist.contenttypes["News"].update()
    18     $splist.contenttypes["News"].fieldlinks.add($fieldlink)
    19     
    20     $splist.contenttypes["News"].readonly=$True
    21     $splist.contenttypes["News"].update()
    22     
    23     
    24     $targetweb.update()
    25     $targetweb.dispose()
    26 }
    27 
    28 
    29 Write-Host -foregroundcolor white "Begin update News ContentType for PriorityValue field."
    30 Write-Host ""
    31 Write-Host ""
    32 Write-Host "updating...."
    33 Write-Host ""
    34 Write-Host ""
    35 
    36 UpdateContentTypeChild $sitecollectionurl
    37 Write-Host -foregroundcolor white "End update News ContentType for PriorityValue field."

    AddContentField.ps1

    View Code
     1 function UpdateContentTypeChild($sitecollectionurl)
     2 {
     3     $sitecol=Get-SPSite $sitecollectionurl
     4     $rootweb=$sitecol.rootweb
     5 
     6     $spfield=$rootweb.availablecontenttypes["News"].fields["PriorityValue"]
     7 
     8 
     9     $targetweb=Get-SPWeb $sitecollectionurl"/en-US/news"
    10     
    11     
    12     $fieldlink=New-object -typename microsoft.sharepoint.SPFieldlink -argumentlist $spfield
    13     $splist=$targetweb.lists["Pages"]
    14     
    15     $splist.contenttypes["News"].readonly=$false
    16     
    17     $splist.contenttypes["News"].update()
    18     $splist.contenttypes["News"].fieldlinks.add($fieldlink)
    19     
    20     $splist.contenttypes["News"].readonly=$True
    21     $splist.contenttypes["News"].update()
    22     
    23     
    24     $targetweb.update()
    25     $targetweb.dispose()
    26 }
    27 
    28 
    29 Write-Host -foregroundcolor white "Begin update News ContentType for PriorityValue field."
    30 Write-Host ""
    31 Write-Host ""
    32 Write-Host "updating...."
    33 Write-Host ""
    34 Write-Host ""
    35 
    36 UpdateContentTypeChild $sitecollectionurl
    37 Write-Host -foregroundcolor white "End update News ContentType for PriorityValue field."
  • 相关阅读:
    洛谷 P3138 [USACO16FEB]Load Balancing S(二维前缀和,离散化)
    洛谷 P1052 [NOIP2005 提高组] 过河(dp,数学)
    洛谷 P1955 [NOI2015] 程序自动分析(并查集,离散化)
    洛谷 P3258 [JLOI2014]松鼠的新家(树上差分,lca)
    洛谷 P2296 [NOIP2014 提高组] 寻找道路(反图bfs)
    洛谷 P4141 消失之物(dp方案数)
    洛谷 P5322 [BJOI2019]排兵布阵(dp,分组背包)
    回溯算法
    分治法
    分支限界法
  • 原文地址:https://www.cnblogs.com/daishuguang/p/3037196.html
Copyright © 2011-2022 走看看