Enable Barcodes in SharePoint 2013 / 2010 / 2007

Bar codes are part of SharePoint Information Management Policies (IMP) feature. If you need bar codes for your document, here are the steps to enable bar codes on SharePoint document library.

Steps to enable bar code in SharePoint:
In SharePoint 2013 (In SharePoint 2007 / SharePoint 2010 too!) enabling barcode is a simple two-step process. (Let’s use it with document content type.)

  1. Create new content type and enable bar code through Information Management Policies.
  2. Add the content type to required libraries.

Step 1: Create new content type:

  1. Navigate to Site Settings >> Click on “Site Content Types”sharepoint 2013 barcode support
  2. Create New content type by clicking the link “Create”
  3. Give a Name to the content type (E.g. “Project Plan”). Specify the parent content type as “Document Content Type” sharepoint barcode documents
  4. Enable bar code through Information Management Policies: From the content type settings page, Click on “Information Management Policies”sharepoint 2013 records management barcode
  5. Click on “Enable Bar code” check box, and click “OK” to save changes.sharepoint 2013 barcode support

 Step 2: Add the content to required libraries
We’ve our content type with bar code enabled ready! Next step is to associate our content types to libraries wherever required.

  1. Go to your target libraries where you need bar code functionality.
  2. Navigate to library settings >> click on “Advanced Settings” >> Enable content types by clicking “Allow management of content types” to “Yes”sharepoint 2013 barcode feature
  3. Now, from the library settings, click on the “Add from existing site content types” link under the “Content Types” section.
  4. Choose the content type we created at step 1 (In my case, it is: “Project Plan”) and click “OK”
  5. Modify the default view of the document libraries to include Bar code columns.barcode in sharepoint 2013
  6. That’s all! We are done! Create new document under the document library, See the bar codes in action!!

Same steps applies to SharePoint 2007/ SharePoint 2010 and for SharePoint 2013.

sharepoint 2010 barcode value

How to Set Custom value to SharePoint Bar Codes?
Well, But the problem is: SharePoint automatically generates unique 10 digit bar code value! we may not need it so in some cases, isn’t it? we want to set bar codes to specific value.

Alright, How do I set the bar code based on the file’s meta-data property? We can programmatically set Bar code values. Here is the sample code for SharePoint 2010 custom barcode generator.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using System.Drawing;
using Microsoft.Office.RecordsManagement.PolicyFeatures;

namespace SetBarCodeValue
{
    class Program
    {
        static void Main(string[] args)
        {
            //Define the parameter values: Site collection URL
            string siteURL = "https://sharepoint.crescent.com/sites/operations";

            using(SPSite site=new SPSite(siteURL))
            {
                using (SPWeb web = site.RootWeb)
                  {
                      //Get a document library
                      SPList list = web.Lists["Design Documents"];
                      //Get an Item 
                      SPListItem item = list.Items[0];

                      //Set Bar code value
                      Image img;
                      string barCodeValue = "900";
                      Barcode.ProvisionBarcodeWithValue(item, true, ref barCodeValue, out img);
                      Barcode.SetBarcodePreview(item);
                      item.Update();                      

                     //Print a message
                     Console.WriteLine("Bar code has been Updated!");
                   }
            }

            //Pause
            Console.ReadLine();
        }
    }
}

You can place this code under the event receiver to set custom barcode values. One drawback with the OOTB SharePoint barcode integration is: it supports only digits!

SharePoint 2010 custom bar code generator:
There are 3rd party components to these limitations and provides enhanced functionalities. Aspose Barcode is one among them. https://www.aspose.com/sharepoint/barcode-component.aspx

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

5 thoughts on “Enable Barcodes in SharePoint 2013 / 2010 / 2007

  • Hello, i enabled the barcode…now i want to diasable the barcode…is this possible on 2013? Thanks Olli

    Reply
  • Hello, Salaudeen
    Thank you for sharing this article.
    Your sharing point barcode generator is good. But now I only have C# barcode generator, I’m wonder whether I can generate barcode with C# barcode generator.
    Best regards.

    Reply
  • Hi Salaudeen, very interesting thank you. A detail you may want to add between steps 4 and 5 : define your barcode content type as “default content type”.
    Isabelle

    Reply
  • OK… so you have a barcode in a column. The feature to insert the barcode in the document was removed in SharePoint 2013. I am curious. What do you plan on using the above instructions for?

    Reply
    • True! Because of low adoption, This feature was dropped in SharePoint 2013! But you can make a Open XML application that takes the server side barcode and injects into the Word document.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *