Category Archives: SharePoint 2016

C# Read Excel file with worksheets

using System.Data; using System.Data.OleDb; private void readExcel () { OleDbConnection conn = new System.Data.OleDb.OleDbConnection((“provider=Microsoft.ACE.OLEDB.12.0; ” + (“data source=C:\\Projects\\Driver Reports.xlsx; ” + “Extended Properties=’Excel 12.0;HDR=Yes;IMEX=1;’;”))); // Select the data from Sheet1 of the workbook. OleDbDataAdapter ada = new OleDbDataAdapter(“select * from … Continue reading

Posted in Excel, SharePoint 2016, Visual Studio 2010 | Leave a comment

Overcoming the List View Threshold in SharePoint CAML queries

Great article written by Jonathan Cardy: https://www.codeproject.com/Articles/1076854/Overcoming-the-List-View-Threshold-in-SharePoint-C How to write scalable CAML queries that won’t return list view threshold errors on large SharePoint lists. Introduction When your CAML queries start to hit the list view threshold, you’ll think it will … Continue reading

Posted in CAML, SharePoint 2010, SharePoint 2016 | Leave a comment

SharePoint 2016 – Change SuitBar’s Text, add a logo and URL – PowerShell

This is how you can change the OOTB ‘SharePoint’ text on the top left corner, and also add your logo and URL: Add-PsSnapin Microsoft.SharePoint.PowerShell $webapp = Get-SPWebApplication “http://mysites.yourwebsite.com” $webapp.SuiteNavBrandingText = “Home Page” $webapp.SuiteNavBrandingLogoTitle = “Home Page” $webapp.SuiteNavBrandingLogoUrl = “http://yourwebsite.com/_catalogs/masterpage/Master%20Page/images/logo_white.png” $webapp.SuiteNavBrandingLogoNavigationUrl … Continue reading

Posted in SharePoint 2016 | Leave a comment

Rich Text Box (InputFormTextBox) not working within UpdatePanel in SharePoint 2016

After we have migrated some web parts from SharePoin 2010 to 2016. The rich text box (InputFormTextBox) is not working properly inside UpdatePanels. Symptoms: After each Ajax call or partial page update: 1. An extra rich text box appears on … Continue reading

Posted in SharePoint 2016 | Leave a comment

Add an assembly into .wsp package

I have a project that needs to use Microsoft Exchange WebServices (Microsoft.Exchange.WebServices.dll). After I deployed the solution into SharePoint 2016, sometimes I receive the following error: System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.Exchange.WebServices, Version=15.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of … Continue reading

Posted in SharePoint 2010, SharePoint 2016, Visual Studio 2010, Web Service | Leave a comment

System.Net.WebRequest throws a “(401) Unauthorized” error: The Double Hop Syndrome.

When using System.Net.WebRequest to POST (or GET) data to a SharePoint page, a 401 Unauthorized error occurs. For example: Uri address = new Uri(“http://mysiteurl.com/somepage.aspx?someparam=something”); System.Net.WebRequest request = System.Net.WebRequest.Create(address); request.Credentials = System.Net.CredentialCache.DefaultCredentials; request.Method = “GET”; System.Net.WebResponse response = request.GetResponse();  response.Close(); The … Continue reading

Posted in SharePoint 2016, Visual Studio 2010 | Leave a comment

Get error messages by Correlation ID

When I get an error in SharePoint with a correlation ID, I find it easy to use the following PowerShell script to search for the detailed error message within the farm: Add-PsSnapin Microsoft.SharePoint.PowerShell Merge-SPLogFile -Path C:\Temp\log\log.txt -Level “Unexpected” -Correlation 6911329e-d6ff-c016-d2d4-1cd533dc1c03 … Continue reading

Posted in PowerShell, SharePoint 2010, SharePoint 2016 | Leave a comment