Try Now
More in this section

Forums / Developing with Sitefinity / Get document meta data

Get document meta data

2 posts, 0 answered
  1. Al
    Al avatar
    33 posts
    28 Dec 2008
    04 Aug 2010
    Link to this post

    Ive got a user control which has a dropdown list populated with the names of the available libraries. When the user selects one from the list a grid is populated with the documents in that library:

    In short like this:

    1.//get the selected library
    2.        Telerik.Libraries.ILibrary oSelectedLib = this._oLibMgr.GetLibrary(LibraryDropDownList.SelectedItem.Text);
    4.        //convert the library ID(s) into an array because the GetDocuments method requires an array
    5.        Guid[] parentIDArray = new Guid[1];
    6.        parentIDArray[0] = oSelectedLib.ID;
    8.        IList oDocuments = this._oLibMgr.GetDocuments(0, 0, "", parentIDArray);

    So now I have an object oDocuments which contains a list of the documents, however what it doesnt store is the document name.

    How do i extract the meta information (which i believe "name" is one of) for a document? Is GetDocuments really the right method?

  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    01 Feb 2016
    05 Aug 2010
    Link to this post
    Hi Al,

    The oDocuments list contains objects of type IContent. You should subscribe to the ItemDataBound event of the grid and if you are binding a data row you should get the DataItem and cast it to IContent. Then you should use GetMetaData("Name") method of IContent object to get the meta field and pass the value to the respective column.

    Sincerely yours,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered