SharePoint: Add item to Links list through Powershell

Following powershell  function adds an item to the links list.

function Add-SPLinkListItems
{
    param($siteCollectionUrl, $listTitle, $itemDescription, $itemUrl) 
    $site =new-object Microsoft.SharePoint.SPSite($siteCollectionUrl)
    $web = $site.OpenWeb("")
    $list = $web.Lists[$listTitle]
    $item = $list.Items.Add()
    $urlValue = New-Object Microsoft.SharePoint.SPFieldUrlValue("")
    $urlValue.Description = $itemDescription;
    $urlValue.Url =  $itemUrl
    $item["URL"] = $urlValue
    $item.update()
    $List.update()
    $web.Dispose()
    $site.Dispose()
}
Using the function:
Add-SPLinkListItems "http://intranet.contoso.com" "My Links" "Google" "http://www.google.com"



profile for Nadeem Yousuf at SharePoint Stack Exchange, Q&A for SharePoint enthusiasts

+