Hide the Ribbon Controls in SharePoint 2013

I’m using modal dialog boxes (Fancybox) in my jQuery project, and I didn’t want the usual SharePoint ribbon header to appear in these.  The simple solution was to hide the ribbon controls in SharePoint 2013 using the following jQuery:


SharePoint PeopleEditor Dialog is Hidden behind the Modal dialog

In my SharePoint site I use modal dialog boxes (Fancybox, actually) to display content.  In one of these dialog boxes is a PeopleEditor SharePoint control which (when you browse for a person) opens up another dialog box!  Unfortunately this dialog box is created in the ‘parent’ DOM and not the page that is open in the Fancybox dialog (which is actually displaying content using an IFrame), so the SharePoint PeopleEditor dialog is hidden behind the modal dialog.  The PeopleEditor dialog box also gets displayed underneath my Fancybox dialog, and is generated on the fly!  So I needed to ensure that it displayed above my Fancybox dialog.  I did this using jQuery:

Using my PeopleEditor control:

I got hold of the ‘Browse’ button that gets generated in the DOM, and added to the click event like so:

What this does is loop every 100 milliseconds until the PeopleEditor dialog box (with a class name of ms-dlgContent) in the parent window (top.document) is created, and then it changes the z-index order to something higher than my Fancybox (9999).  Voila!


I’ve got a few lightboxes in my SharePoint 2013 Web Application, and one of the pages I need to launch in a lightbox iframe contains Plupload.  When I clicked on the link to launch the lightbox, nothing appeared in Chrome and I got an error message in Internet Explorer.  Apparently it’s due to a security feature to combat clickjacking.

I tried to fix the issue by using meta tags and also amending the response headers in IIS, but neither appeared to work.  What did work was the Ventigrate Permissive XFrame Header, but rather than include this plugin I just included the class in my project and it worked like a charm.  So….

Use the following class, remembering to specify the correct namespace for your project:

now in your web.config, add the reference to your class, namespace and assembly like so:

AlkaneNamespace is the namespace of the class, PermissiveXFrameHeaderModule is the name of the class and AlkaneSolutions is the name of the assembly in the GAC.  To get the version/PublicKeyToken information you can follow the post here.


Parsing a SharePoint Lookup Field using SPFieldLookupValue

This is a quick example of parsing a SharePoint Lookup field using SPFieldLookupValue.  As we know, SharePoint lookup fields are usually formed as such:

[Lookup ID];#[Lookup Value]

Rather than manually parsing this result (by perhaps splitting the returned string by ‘;#’) we can simply obtain these values using the SPFieldLookupValue:



Find a Users SharePoint Group Membership

This example shows how we can find a users SharePoint group membership by utilising SPGroupCollection.  Remember that if you are running your code with SPSecurity.RunWithElevatedPrivileges, you should set the SPUser value OUTSIDE of this elevated code otherwise it will not work for the current user running the browser session.


Reading from a SharePoint List using ASP.Net

You may wish to consult this article first to see how to add a reference to the SharePoint library.  This post describes reading from a SharePoint List using ASP.Net.

This example shows how we can define a CAML query to return a set of data from a SharePoint list.


Insert into a SharePoint List using ASP.Net

This post describes how to insert into a SharePoint list using ASP.Net.  First add a reference to the SharePoint DLL for your specific version.  I’m working with SharePoint 2010, and the DLL can be found in the following location:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.SharePoint.dll

Ensure in your page that you import the namespace:

Now I’ve just dumped some example code below, which inserts into a Text field (obtained from a Textbox), a Multi choice field (obtained from a CheckList box) and a User field (obtained from a SharePoint PeopleEditor control).  I’ve also left a few comments in intentionally, as I tried different ways of doing things.  I found that if I ran this chunk of code with elevated privileges it inserted the entry into the list but didn’t trigger the associated workflow.  I also tried to run it as an impersonated user, but it still didn’t trigger the workflow.  So I commented out the RunWithElevated privileges line and it all worked well – the list item inserted and the associated workflow triggered.

You can also see that for the list name, I store this in the Web.Config file since I use the same list throughout the site.