Posts

Showing posts from May, 2017

Project Server access using OData service

// Get Project data function GetProjectData(filterValues) {     var d = $.Deferred();     var url = "https://epmo.dtz.com/Defence/_api/ProjectData/Projects?$select=ProjectName,ProjectIDCopy,ProjectDescriptor,DeliveryAgentProjectManager,ProjectDeliveryRegion,ProjectManagerName,TotalMultiYearbudget";     var filter = "";     // Creating the filter     for (var property in filterValues) {         if (filter && filterValues[property]) {             filter += " and ";         }         if (filterValues[property]) {             filter += "substring(" + property + ",0," + (Number(filterValues[property].length) - Number(1)) + ") eq" + "'" + filterValues[property] + "'";  // Building filter eg:substring(ProjectName, 1, 2) eq 'CA'         }     };     // If filter is not null append it to the url     if (filter) {         url = url + "&$filter=" + filter;    

Reading Excel file Rows and Cells C# code

Simple POC did to read Excel file rows and columns. Code extracted from following link. https://www.codeproject.com/Tips/801032/Csharp-How-To-Read-xlsx-Excel-File-With-Lines-of       public static void ReadExcel()         {             var count = 0;             foreach (var worksheet in Workbook.Worksheets("2010AllItems.xlsx"))                 foreach (var row in worksheet.Rows)                 {                     count++;                     foreach (var cell in row.Cells)                     {                         Console.WriteLine(cell.Text);                         // if (cell != null) // Do something with the cells                     }                     if (count > 2)                         break;                 } }

SharePoint 2013 bulk Item Update C# code

For more information check this link.         http://sharepointkitchen.blogspot.com.au/2014/12/bulk-insertupdatedelete-items-from.html public static void BulkUpdate()         {             var siteUrl = "http://zdc1ws048:4321/test/Sharepoint2010";             var listName = "TestList";             var columnName = "Title";             var searchValue = "TestValue07";             var newValue = "It is Updated";             try             {                 using (SPSite _oSite = new SPSite(siteUrl))                 {                     using (SPWeb _oWeb = _oSite.OpenWeb())                     {                         SPList _oList = _oWeb.Lists.TryGetList(listName);                         if (_oList != null)                         {                             _oWeb.AllowUnsafeUpdates = true;                             Guid listGuid = _oList.ID;                             StringBuild