Author Archives: Lin Zhang

Event Receiver does not fire

I wrote an event receiver for a list but it seems not firing when you add/update/delete an item. I used the following Powershell script to see what event receivers that are attached to this list: Add-PsSnapin Microsoft.SharePoint.PowerShell $spWeb = Get-SPWeb … Continue reading

Posted in SharePoint 2010, PowerShell | Leave a comment

Get all items from a list performance

Running on a list with 4,000 items. Option 1 is on average 1 second slower than Option 2. Option 1: using (SPSite currentSite = new SPSite(SPContext.Current.Site.ID)) { using (SPWeb currentWeb = currentSite.OpenWeb(“crm”)) { DateTime dt1 = DateTime.Now; DateTime dt2 = … Continue reading

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

SharePoint 2013/2016 Branding

1. Create a html/css/javascript file using your favorite designer tool; 2. Go to SharePoint >> Site Settings >> Designer Manager; 3. Go to “Step 3 Upload design files” and Map the following location as a network drive so you can … Continue reading

Posted in SharePoint 2016 | Tagged | Leave a comment

Create a notification banner on top of every page in a SharePoint 2010 site collection using delegate control

We wanted to create a notification banner on top of every page in a SharePoint 2010 site collection like this: You could modify the master page for each site but that very cumbersome. So we will use the “Delegate Control” … Continue reading

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

How to Recover A Single Document In SharePoint

How to Recover A Single Document In SharePoint How to Recover A Single Document In SharePoint Once upon a time at a customer site (August of last year, in fact), one of the users made some changes to an Excel … Continue reading

Posted in SharePoint 2010, Uncategorized | Leave a comment

Create a cross-site lookup field using PowerShell

Sometimes you need to create a lookup field to look up a list in another site (not the parent site). This is how  you can do it using PowerShell: On SharePoint server, run PowerShell as admin: Add-PsSnapin Microsoft.SharePoint.PowerShell $targetWeb = … Continue reading

Posted in PowerShell, SharePoint 2010 | Leave a comment

Enable Debugging and set custom errors off in SharePoint

The original post is here: https://blogs.msdn.microsoft.com/voyage/2014/09/02/enable-debugging-and-set-custom-errors-off-in-sharepoint/ Thanks Deepa Lakhani. To debug a SharePoint solution you need to set following values in web.config 1. Turn on the call stack (CallStack=”true”) 2. Disable custom errors (<customErrors mode=”Off” />) 3. Enable debugging (<compilation debug=”true”>) … Continue reading

Posted in Uncategorized | Leave a comment