public void SetCustomProperty(string propertyName, string propertyValue)
 {
     m_field.SetCustomProperty(propertyName, propertyValue);
 }
        private void CreateVendorDocumentsLibrary(SPWeb web, SPContentType vendorDocumentContentType)
        {
            SPList vendorDocumentsLibrary = web.Lists.TryGetList(Resource.VendorDocumentsLibrary);

            if (vendorDocumentsLibrary == null)
            {
                // Create library
                Guid listGuid = web.Lists.Add(Resource.VendorDocumentsLibrary, Resource.VendorDocumentsLibraryDesc, SPListTemplateType.DocumentLibrary);
                vendorDocumentsLibrary = web.Lists[listGuid];
                vendorDocumentsLibrary.ContentTypesEnabled = true;
                vendorDocumentsLibrary.EnableVersioning    = true;
                vendorDocumentsLibrary.OnQuickLaunch       = true;
                vendorDocumentsLibrary.ContentTypes.Add(vendorDocumentContentType);
                vendorDocumentsLibrary.ContentTypes["Document"].Delete();
                vendorDocumentsLibrary.Update();
            }

            if (!vendorDocumentsLibrary.Fields.ContainsField("Vendor"))
            {
                // Create the hidden note field needed for BCS
                SPField noteVendorField = vendorDocumentsLibrary.Fields.CreateNewField("Note", "Vendor_ID");
                noteVendorField.Hidden        = true;
                noteVendorField.ReadOnlyField = true;
                noteVendorField.SetCustomProperty("BdcField", "Vendor_ID");
                noteVendorField.StaticName = "Vendor_ID";
                vendorDocumentsLibrary.Fields.Add(noteVendorField);

                // Create the vendor field using BCS
                SPBusinessDataField vendorField = vendorDocumentsLibrary.Fields.CreateNewField("BusinessData", "Vendor") as SPBusinessDataField;
                vendorField.SystemInstanceName = "Guidewire";
                vendorField.EntityNamespace    = "Guidewire";
                vendorField.EntityName         = "Vendor";
                vendorField.StaticName         = "Vendor";
                vendorField.BdcFieldName       = "ContactID";
                vendorField.HasActions         = false;
                vendorField.Required           = true;
                vendorField.RelatedField       = "Vendor_ID";
                vendorDocumentsLibrary.Fields.Add(vendorField);
            }
            if (!vendorDocumentsLibrary.Fields.ContainsField("Vendor Document"))
            {
                // Create the hidden note field needed for BCS
                SPField noteVendorDocumentField = vendorDocumentsLibrary.Fields.CreateNewField("Note", "Vendor Document_ID");
                noteVendorDocumentField.Hidden        = true;
                noteVendorDocumentField.ReadOnlyField = true;
                noteVendorDocumentField.SetCustomProperty("BdcField", "Vendor Document_ID");
                noteVendorDocumentField.StaticName = "Vendor_x0020_Document_ID";

                // Create the vendor document field using BCS
                SPBusinessDataField vendorDocumentField = vendorDocumentsLibrary.Fields.CreateNewField("BusinessData", "Vendor Document") as SPBusinessDataField;
                vendorDocumentField.SystemInstanceName = "Guidewire";
                vendorDocumentField.EntityNamespace    = "Guidewire";
                vendorDocumentField.EntityName         = "Vendor Document";
                vendorDocumentField.StaticName         = "Vendor_x0020_Document";
                vendorDocumentField.BdcFieldName       = "ContactID";
                vendorDocumentField.HasActions         = false;
                vendorDocumentField.RelatedField       = "Vendor_x0020_Document_ID";
                vendorDocumentField.SetSecondaryFieldsNames(new string[] { "Category", "ContactID", "ContactName", "Status", "Subcategory", "PublicID" });
                vendorDocumentsLibrary.Fields.Add(vendorDocumentField);
            }
        }