Quantcast
Channel: SharePoint Diary
Viewing all articles
Browse latest Browse all 1058

Enable Barcodes on SharePoint 2013 / 2010 / 2007

$
0
0
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 barcodeis a simple two step process. (Lets use it with Document content type.)
  1. Createnew content type and enable bar code through Information Management Policies.
  2. Add the content to required libraries.
Step 1: Createnew content type:
  1. Navigate to Site Settings >> Click on "Site Content Types"sharepoint 2010 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 2010 records management barcode
  5. Click on "Enable Bar code" check box, and click "OK" to save changes.sharepoint 2010 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 2010 barcode feature
  3. Now, from the library settings, Click on "Add from existing site content types" link under "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 2010
  6. That's all! We are done! Create new document under the document library, See the bar codes in action!!barcode with sharepoint
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 bar code based on 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 = "http://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 event receiver to set custom barcode values. One draw back 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. http://www.aspose.com/sharepoint/barcode-component.aspx

Viewing all articles
Browse latest Browse all 1058

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>