Import and Export document library in SharePoint PowerShell

In this article we can able to see how to export and import document library using PowerShell, here we need to get all version document modified history and including users.

Now using the below script we are exporting in to our local D drive.

Export-SPWeb http://dotsharepoint.com/sites/SP/Documentsite/ –Path "D:\Documents.cmp" -ItemURL "Shared%20Documents" –IncludeUserSecurity  -IncludeVersions All

Now using the below script we are importing to another SharePoint site

Export-SPWeb http://dotsharepoint.com/sites/SPSite/NewDocuments/ –Path "D:\Documents.cmp" – force  –IncludeUserSecurity



SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

How to get field empty values in SharePoint using PowerShell

In this article we can able to see how to get the empty values in a field with count using PowerShell
We are having list with more than 10k items in that we are have a field with Status, now we have to know for this particular filed having empty values.

Add-PSSnapin microsoft.sharepoint.powershell
$web = Get-SPWeb http://dotnetsharepoint.com/sites/sharepoint
$list = $web.lists["ListName"] 
  $i = 0;
write-host $list
$items = $list.items
 #Go through all items
foreach($item in $items)
{
 $mystring = $item["Status"]
IF([string]::IsNullOrEmpty($mystring))
{
write-host  $item.ID
$i = $i+1
}
 }

Write-host "total final items" $i

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator

We tried to delete a list in SharePoint suddenly we got an error message   “The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.


Using GUI we are unable to delete the list because of list view threshold for this using PowerShell we disable the list view threshold.

 Add-PSSnapin Microsoft.SharePoint.PowerShell
$web = Get-SPWeb http://dotnetsharepoint.com/sites/sharepoint
$list = $web.Lists["ListName"]
write-host $list
$list.EnableThrottling = $false
$list.Update();

Now we can able to delete the list without any issues.


SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

enter only numbers in text box in SharePoint

In this article we are able to see how to allow to enter only numbers in a Textbox using JQuery/Java Script.
Could not save the list changes to the server SharePoint designer 2013
Disable list throttling SharePoint using PowerShell
We are having a column with name ZIP, in that we are allowing users to enter only numbers, we designed the form and based on the title we are getting the field, using Keydown  function.   we are using the below code .

<script language="javascript" type="text/javascript">
$(document).ready(function() {               
  $('input[title="ZIP"]').bind("keydown", function (event) {
    if ( event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 || event.keyCode == 13 ||
            
            (event.keyCode == 65 && event.ctrlKey === true) ||

      
            (event.keyCode >= 35 && event.keyCode <= 39)) {
              
              return;
        }
        else {
            
            if (event.shiftKey || (event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105 )&&(event.keyCode!=190)&&(event.keyCode!=110)) {
                event.preventDefault();
            }
        }
   });

               
});
                </script>



SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

Copy data from one list to another list in SharePoint using PowerShell

In this article we are copying values from one list to another list in SharePoint using PowerShell
In both list having field “uniqueid” , using the “uniqueid” only I am updating values from LISTB to LISTA. In LISTB having more fields we need to copy the value from LISTB to LISTA , using camel query we are getting the value from LISTA in to this variable “$item['uniqueid']” and in FieldRef Name  we have to give the LISTB  field name.
Below is the script to update the items.

Add-PSSnapin Microsoft.sharepoint.powershell
      $web =  Get-SPWeb "http://dotnetsharepoint.com /sites/sharepoint/"
      write-host $web
    $Source =$web.Lists["LISTA"]           
     $Dest = $web.lists["LISTB”]
     write-host = $Source
     Write-host = $Dest
                            
    $items = $Source.items
    foreach ($item in $items) {
  
      $camlQuery ="<Where><Eq><FieldRef Name='uniqueid' /><Value Type='Text'>"+$item['uniqueid']+"</Value></Eq></Where>"
        $spQuery = new-object Microsoft.SharePoint.SPQuery
        $spQuery.Query = $camlQuery
        $spQuery.RowLimit = 1
        #check if the item is already present in destination list
         $ditems =  $Dest.GetItems($spQuery)
             $item["UserName"] = $ditems[0]["UserName"] 
 $modifiedBy = $item["Editor"]
$modifieddate =$item["Modified"]
Write-Host $item.ID
$item["Editor"] = $modifiedBy
$item["Modified"] = $modifieddate
$item.Update()
$Source.Update()
#Write-Host $count+1
        }

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM