Interview Questions administrator

Best SharePoint administrator Interview Questions and Answers with topic wise:

Recycle Bin | MMS | ManagedVsCrawledProperties |

Thursday, June 26, 2014

Create single/multi lookup columns in SharePoint Using Powershell

Below script will helps us on how to create single lookup and multi lookup fields in SharePoint using PowerShell. please refer my previous posts on below scenarios:
  1. Create a new list in SharePoint using powershell?
  2. Check whether the list exits or not?
  3. Create a new field in SharePoint list using powershell
  4. Add items to the list in SharePoint using powershell?
  5. Create single lookup field in SharePoint using powershell?
  6. Create multi lookup field in SharePoint using powershell?
Download the script URL: Click here to download script

Please correct the syntax as below for the scripts. 
e.g:  Replace displayname=""+ $DisplayName +"" to DisplayName='"+ $DisplayName +"'  
$listname = "List Name";

$docSite = new-object Microsoft.SharePoint.SPSite($siteURL)
$docWeb = $docSite.OpenWeb()


function Add-SPLookUpField([string]$listName, [string]$DisplayName,[string]$lookupListName, [string]$Hidden, [string]$Readonly, [string]$showField, [string]$Name, [string]$Required)
  $OpenList = $docWeb.Lists[$listName]
  $lookupListGuid= $docWeb.Lists[$lookupListName]
  $lookupXMLString = "
please let me know if faced any issues..

Sasi Kumar Reddy

No comments:

Post a Comment