当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 在 SharePoint 中设置超链接或图片列的默认值

作者:精品下载站 日期:2024-12-14 14:02:07 浏览:13 分类:玩电脑

在 SharePoint 中设置超链接或图片列的默认值


要求:为 SharePoint 列表中的超链接或图片列设置默认值

SharePoint 中的超链接或图片类型列中没有指定默认值的规定!在某些情况下,我们可能希望指定 SharePoint 2010/2013 超链接列默认值。但是 SharePoint Web UI 中没有输入超链接字段默认值的选项!

[玩转系统] 在 SharePoint 中设置超链接或图片列的默认值

如何在 SharePoint 中设置超链接或图片字段的默认值?

我们可以使用PowerShell设置SharePoint超链接列的默认值!使用此 PowerShell 脚本指定超链接或图片类型字段的默认值:


Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Variables
$WebURL="https://intranet.crescent.com"
$ListName="Proposal Documents"
$ColumnName="Reference URL"
$DefaultValue="https://externalsites.crescent.com" 

#Get the Web
$web = Get-SPWeb $WebURL
 
#Get the List
$list = $web.Lists.TryGetList($ListName)
 
If($list -ne $null)
{
 #Get the column
 $column = $list.Fields[$ColumnName]

 if($column -ne $null)
 {
     #Set Default Value
     $column.DefaultValue = $DefaultValue
     $column.Update()
     $list.Update()
     Write-Host " Default value set for the column!" 
 }
 }
$web.Dispose() 

以下是以编程方式指定的 SharePoint 列表超链接默认值的输出:

[玩转系统] 在 SharePoint 中设置超链接或图片列的默认值

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯