I am working on a PowerShell script to create a new Document Library for a site, however, I need to add a hyperlink field. How would I go about coding that? I think the internal field name is "fileref".
Here is my current code which creates 1 text field.
$webURL=“http://xyz/sites/intranet/abcsite"
$spSite=[Microsoft.SharePoint.SPSite]($webURL)
$spWeb=$spSite.OpenWeb()
# Create a document library (ID is 101)
$myListGuid=$spWeb.Lists.Add(“riskmgmt”,“Risk Management”,101)
$myList=$spweb.Lists[$myListGuid]
#
# Update the List Title
$myListObj=$spWeb.Lists["riskmgmt"]
$myListObj.Title=“Risk Management”
$myListObj.Update()
#
# Adding fields
$myFieldCustomerName=$myList.Fields.Add(“Procedure”,“Text”,0)
$myList.Fields[$myFieldCustomerName].Title=“Procedure Title”
$myList
.Fields[$myFieldCustomerName].Update()
$spWeb.Dispose()
$spSite.Dispose()
If I go into the library settings and manually update the columns I would need to add they hyperlink field which includes the URL and the description. How do I get the same results, but through PowerShell?