I have a column in a document set that I want hidden when a user creates it but visible when I edit the document set properties. How can I do this?
-
Hi Carolin! Welcome to SharePoint S.E.! I'm afraid I don't believe this is possible OOTB... But if you're able to use Javascript or potentially InfoPath Designer, you could "hide" those columns in the display form... Can I ask why this issue can't be solved with User Training/policy enforcement rather than a modification on the SharePoint side?– KGlasierJan 18, 2019 at 17:05
-
Thank you for your quick response. Our users have a situation where they would like to be able to flag packages with an approval status. We have it currently setup so that the status is Pending when the doc set is created. However, they do not want the status visible to the end user, only the internal staff. I wasn't aware we could use InfoPath to design the new form page on Document Sets. Is this new? I'll look further for a JavaScript solution. Thanks again.– Carolin MJan 18, 2019 at 17:39
-
"not...visible to the end user, only the internal staff" is slightly different than hidden on the New form and visible on the Edit form - are "end users" able to edit the document set properties? If so, even if you hide the column on the New form, it will still be visible to everyone on the Edit form. That being said, if that's an acceptable solution, there is a way to do it without customizing the form, if you have devs/admins comfortable with Powershell and willing to make a change that way.– Dylan CristyJan 18, 2019 at 17:56
-
Hello, did my script helped you?– Zdeněk VinduškaFeb 6, 2019 at 12:48
1 Answer
you are able to hide,show fields in NewForm, EditForm and ViewForm by Powershell. Here is example (this is for SPO, cause you didn't mentoined if its SPS or SPO). For SPS is like this, but you need to use different commandlets:
$username = "[email protected]"
$password = ConvertTo-SecureString "Password" -AsPlainText -Force
$siteUrl = [string]::Format("https://company.sharepoint.com/sites/site")
$cc = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$cc.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
$listTitle = "Documents"
$fieldName = "Title"
$Web = $cc.Web
$cc.Load($Web)
$cc.ExecuteQuery()
$List = $web.Lists.GetByTitle($listTitle)
$cc.Load($List)
$cc.ExecuteQuery()
$fields = $list.Fields
$cc.Load($fields)
$cc.ExecuteQuery()
foreach($field in $fields)
{
if($field.InternalName -eq $fieldName)
{
Write-Host "Editing field view availability:" $fieldName
$cc.Load($field)
$field.SetShowInNewForm($false) #Hidden in New Form
#$field.SetShowInEditForm($false)
#$field.SetShowInDisplayForm($false)
$field.Update()
$cc.ExecuteQuery()
}
}
$Web.Dispose()
$cc.Dispose()