How to remove barcode from list items
Hi, I have found a way to remove them by writing code. I tried this in my testing environment and it worked. I am sharing this code for you: SPSite site = new SPSite("YourSiteUrl"); SPWeb web = site.OpenWeb(); web.AllowUnsafeUpdates = true; SPList listSource = web.Lists["YourListName"]; SPField field1 = listSource.Fields["FieldName"]; field1.AllowDeletion = true; field1.Sealed = false; field1.Delete(); listSource.Update(); web.AllowUnsafeUpdates = false; I hope this will help you outThanks, Rahul Rashu
October 19th, 2011 8:23am

Hi, I have developed this code for you so that you can use it in all such situations using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.SharePoint; namespace DeleteBarcodeIRMPolicyColumns { class Program { static void Main(string[] args) { Console.WriteLine("This tool will remove barcode related columns from your list. Before executing this tool make sure that you have removed the policy otherwise it will take you to some other issues "); Console.WriteLine("Please enter your site url"); String siteUrl = Console.ReadLine(); Console.WriteLine("Please enter your List Name"); String listName = Console.ReadLine(); try { using (SPSite site = new SPSite(siteUrl)) { using (SPWeb web = site.OpenWeb()) { web.AllowUnsafeUpdates = true; SPList listSource = web.Lists[listName]; String[] columnNames = { "Barcode", "Barcode Value", "Exempt from Policy" }; for (int i = 0; i < columnNames.Length; i++) { SPField fieldtoBedeleted = listSource.Fields[columnNames[i]]; fieldtoBedeleted.AllowDeletion = true; fieldtoBedeleted.Sealed = false; fieldtoBedeleted.Delete(); listSource.Update(); } web.AllowUnsafeUpdates = false; Console.WriteLine("The columns are deleted successfully"); Console.ReadLine(); } } } catch (Exception e) { Console.WriteLine(e.Message); Console.ReadLine(); } } } } I hope this will help you out. Thanks, Rahul Rashu
Free Windows Admin Tool Kit Click here and download it now
October 20th, 2011 9:44pm

Hi, I have developed this code for you so that you can use it in all such situations using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.SharePoint; namespace DeleteBarcodeIRMPolicyColumns { class Program { static void Main(string[] args) { Console.WriteLine("This tool will remove barcode related columns from your list. Before executing this tool make sure that you have removed the policy otherwise it will take you to some other issues "); Console.WriteLine("Please enter your site url"); String siteUrl = Console.ReadLine(); Console.WriteLine("Please enter your List Name"); String listName = Console.ReadLine(); try { using (SPSite site = new SPSite(siteUrl)) { using (SPWeb web = site.OpenWeb()) { web.AllowUnsafeUpdates = true; SPList listSource = web.Lists[listName]; String[] columnNames = { "Barcode", "Barcode Value", "Exempt from Policy" }; for (int i = 0; i < columnNames.Length; i++) { SPField fieldtoBedeleted = listSource.Fields[columnNames[i]]; fieldtoBedeleted.AllowDeletion = true; fieldtoBedeleted.Sealed = false; fieldtoBedeleted.Delete(); listSource.Update(); } web.AllowUnsafeUpdates = false; Console.WriteLine("The columns are deleted successfully"); Console.ReadLine(); } } } catch (Exception e) { Console.WriteLine(e.Message); Console.ReadLine(); } } } } I hope this will help you out. Thanks, Rahul Rashu
October 22nd, 2011 2:57pm

Hi ! I enabled Barcoding on one of the list in Sharepoint by going to Settings> Information Management Policy Settings > .. . There were already some list items in the list and as soon as I enabled barcoding, unique barcodes were assigned to each list item. Now the other team doesn't want barcodes.. for now. So I disabled barcoding back. I thought disabling barcode would remove the 2 fields Barcode and Barcode Value from the list. But I still see Barcode field when I open a list item. The items still have a barcode and I cannot find a way to delete it. I checked out Content types - both barcode feilds does not show up, but when I open views I still have an option to include it in view and it still appears in list items. How do I get rid of Barcode completely ? There are about 200 list items with barcodes now, how do I remove it from everywhere ? Thanks !
Free Windows Admin Tool Kit Click here and download it now
October 22nd, 2011 3:14pm

Hi Rahul, Thanks a lot mate ! It's great. I would definitely try out your solution. Thanks again.
October 22nd, 2011 4:00pm

Hi Emir, Yea, I suspected that. From what I found out, Barcode and Barcode value becomes part of meta data of the list once you enable it. You are right, those are the 2 scenarios I am seeing. For new list items created, there is no Barcode value assigned to them but I still see Barcode field and no value in it. I wish if there could be a easier way to just hide it from the user.. I mean, can I just hide Barcode field from "View Item" webpage ? It will be great if I don't have to create another view page and redirect user to it. Thanks a lot !
Free Windows Admin Tool Kit Click here and download it now
October 22nd, 2011 4:06pm

Hi, These are the sealed columns and you can not delete them. However as per your requirement just uncheck them under the columns in view settings. Thanks, Rahul Rashu
October 23rd, 2011 1:09am

Hi pratz09, Once you enabled Barcodes on the list, the two columns named Barcode and Barcode Value will always exist, no matter whether you disabled Barcodes policy later or not. But there are two scenarios about the two columns: First: The items created before Barcodes disabled can always show values of Barcode and Barcode Value, no matter Barcodes is disabled or not. Second: Items created after Barcodes disabled can still have the two columns (Barcode and Barcode Value), but can’t show values. So, the simplest way is to hide the two columns of the list from “Modify this View”. Hope this helps. Thanks, Emir
Free Windows Admin Tool Kit Click here and download it now
October 23rd, 2011 1:14am

Hi, I have found a way to remove them by writing code. I tried this in my testing environment and it worked. I am sharing this code for you: SPSite site = new SPSite("YourSiteUrl"); SPWeb web = site.OpenWeb(); web.AllowUnsafeUpdates = true; SPList listSource = web.Lists["YourListName"]; SPField field1 = listSource.Fields["FieldName"]; field1.AllowDeletion = true; field1.Sealed = false; field1.Delete(); listSource.Update(); web.AllowUnsafeUpdates = false; I hope this will help you outThanks, Rahul Rashu
October 23rd, 2011 1:19am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics