0

I have an event reciever that fires when ever an item attachment is added.

 public override void ItemAttachmentAdded(SPItemEventProperties properties)
       {
           base.ItemAttachmentAdded(properties);
       }

enter image description here

The metadata should autocomplete depending on the items name.

Everything is working perfect exact for the comboboxes like the one displayed below (Sector).

I want to know how to change the selected value the combobox programatically.

Ex. i want to change the value to "FF - Fire Fighting".

0

Set Column's Default value to 'FF - Fire Fighting'(your data).

  • Go to List/Libray Settings
  • Edit Column
  • Set Default value what you want.

Set Default Value Programmatically:

using (SPSite siteCollection = new SPSite("http://dev.site.com"))
        {
            using (SPWeb web = siteCollection.OpenWeb())
            {
                SPList customDocumentLibrary = web.Lists["Program Documents"];
                MetadataDefaults columnDefaults = new MetadataDefaults(customDocumentLibrary);

                SPFolder testFolder = customDocumentLibrary.RootFolder.SubFolders["Programs"];

                columnDefaults.SetFieldDefault("/Program Documents/Programs/Academics", "Programs", "Academics");
                columnDefaults.Update();
            }

        }

Ref:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.