如何使用类似Powershell的方法为我的sharepoint在线网站集创建网站栏 [英] How i can create a site column for my sharepoint online site collection using powershell-like approach

查看:93
本文介绍了如何使用类似Powershell的方法为我的sharepoint在线网站集创建网站栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在sharepoint在线办公室365内的网站集上工作,我想创建一个具有以下属性的网站栏:-

I am working on a site collection inside sharepoint online office 365. and i want to create a site column with the following properties:-

1.在显示表单中显示网站栏.同时将其隐藏在创建和编辑表单中.

1. show the site column in the display form. while hide it inside the create and edit forms.

2.用jslink文件链接网站栏.

2. link the site column with a jslink file.

现在,当我在内部工作于共享点时,我通过编写以下Power Shell脚本来做第一点:-

now when i work on sharepoint on-premises, i do the first point by writing the following power shell script:-

$site = Get-SPSite -Identity "http://********/"
$web = $site.RootWeb

#Assign fieldXML variable with XML string for site column
$fieldXML = '<Field Type="Text"
Name="ItemNumber"
Description="auto generated item number.."
DisplayName="Item Number"
StaticName="ItemNumber"
Group="Custom Columns"
Hidden="FALSE"
Required="FALSE"
Sealed="FALSE"
ShowInDisplayForm="TRUE"
ShowInEditForm="FALSE"
ShowInListSettings="TRUE"
ShowInNewForm="FALSE"></Field>'

#Output XML to console
write-host $fieldXML

#Create site column from XML string
$web.Fields.AddFieldAsXml($fieldXML)

第二点,编写以下powershell脚本:-

and for the second point by writing the following powershell script:-

$web = Get-SPWeb http://*****/
$field = $web.Fields["Item Number"]
$field.JSLink = "~siteCollection/Style Library/JS/HideItemNumberInQuickEdit.js"
$field.update($true)

但现在在Office 365内部,我无法运行Powershell脚本.所以谁能离开adivce我如何在Office 365共享点内部实现以上2点呢?我可以运行例如远程Power-shell脚本吗?还是可以使用网站api创建网站列?或任何 其他方法?

but now inside office 365 i can not run powershell scripts. so can anyone adivce how i can achieve the above 2 points inside office 365 sharepoint online? can i run for example remote power-shell scripts? or can i use site apis to create site columns? or any other appraoch ?

推荐答案

请检查下面的链接

https://social.technet.microsoft.com/Forums/office/zh-CN/94964ad8-715a-4257-a4aa-8535155c0d49/how-to-create-site-columns-in-a-site-on -office-365-sharepoint-online-in-powershell-?forum = officeitpro

https://social.technet.microsoft.com/Forums/office/en-US/94964ad8-715a-4257-a4aa-8535155c0d49/how-to-create-site-columns-in-a-site-on-office-365-sharepoint-online-in-powershell-?forum=officeitpro


这篇关于如何使用类似Powershell的方法为我的sharepoint在线网站集创建网站栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆