1.Go to Inforamtion Management Policy Settings,Enable Define Policy.
Enable barcode feature.
2.When Customized for your Requirements throught Coding.
using (siteCollection)
{
using (site)
{
SPList list = site.Lists["MyList"];
SPListItem item = list.AddItem();
item["Title"] = "test2";
// this file just ensure item.File non-null. You could set it to arbitrary value.
SPFile file = site.GetFile(http://wjc:1130/SiteAssets/CEWP.aspx);
FieldInfo itemFileInfo = item.GetType().GetField("m_file", BindingFlags.NonPublic
BindingFlags.Instance);
itemFileInfo.SetValue(item, file);
FieldInfo itemFileInitInfo = item.GetType().GetField("m_fileInit", BindingFlags.NonPublic
BindingFlags.Instance);
itemFileInitInfo.SetValue(item,true);
//item.Update();
System.Drawing.Image img;
string id = "0123456789";
Barcode.ProvisionBarcodeWithValue(item, true, ref id, out img);
Barcode.SetBarcodePreview(item);
item.Update();
Console.Read();
}
}
Links:
http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010programming/thread/b4fab7a5-d21d-4a40-9cec-e9e145802958
http://www.sharepointsecurity.com/sharepoint/sharepoint-development/programmatically-changing-a-sharepoint-barcode/
http://social.technet.microsoft.com/Forums/is/sharepoint2010setup/thread/f232e9d1-09bb-423a-9780-b69d16d51698
http://blogs.msdn.com/b/recman
No comments:
Post a Comment