Inserting Values to Document MetaData Field of Type "Lookup" and "Peron or Group"

Answered Inserting Values to Document MetaData Field of Type "Lookup" and "Peron or Group"

  • Thursday, June 14, 2012 10:07 AM
     
     

    Dear All,

    I have a scenario where i have a drop down list populated from custom SP list. and a Person Picker on Application page. I have to save values in these controls to document library as a metadata with document which i am uploading programmitically. Kindly give some ideas how to do this as i did it fir text fields but facing problem here.

All Replies

  • Tuesday, June 19, 2012 7:58 AM
    Moderator
     
     Answered

    Hi haris,

    When you upload your document by programmatically, it is difficult to deal with your field with out of box. So, you can create an event handle to change your field with document information panel field.

    public override void ItemUpdating(SPItemEventProperties properties)
           {
               properties.AfterProperties["
    Title"] = "test";
               base.ItemUpdating(properties);
           }

    you can refer to the following link.

    http://johanolivier.blogspot.com/2009/12/sharepoint-simple-event-handler.html

    Thanks,

    Jack

  • Tuesday, June 19, 2012 8:08 AM
     
     Answered

    Meta-data have to be stored into a Hashtable

    HashTable MetaDataTable = new HashTable();
    MetaDataTable.Add(“column name”, “value”);

    SPFile currentFile = files.Add(url, fStream, MetaDataTable, true);


    Success is a slow rider, it requires a lot of time, I need pace in life, so left success and moved ahead.