Posts

Showing posts from July, 2016

Updating Excel data to Share Point List Items based on Id

Loading Excel Data  public void LoadExcelData()         {             string fileName = "D:/Employee.xlsx";                     string fileExtension = Path.GetExtension(fileName).ToUpper();             string connectionString = "";             if (fileExtension == ".XLS")             {                 connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" + fileName + "'; Extended Properties='Excel 8.0;HDR=YES;'";             }             else if (fileExtension == ".XLSX")             {                 connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + fileName + "';Extended Properties='Excel 8.0;'";                 //string connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\source\\SiteCore65\\Individual-Data.xls;Extended Properties=Excel 8.0;HDR=YES;";             }             if (!(string.IsNull

Deleting Share Point list Items using powershell.

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue try {      $web = Get-SPWeb "http:/Testurl/sites/Feedback/"    $list = $web.Lists["Survey"]    $caml='<Where><Eq><FieldRef Name="Month" /><Value Type="Text">June</Value></Eq></Where>' $query=new-object Microsoft.SharePoint.SPQuery $query.Query=$caml $col=$list.GetItems($query) Write-Host $col.Count $col | % {$list.GetItemById($_.Id).Delete()} $web.Dispose() } catch { write-host $_.exception } Hope... This code will help you...