More in this section

Forums / Developing with Sitefinity / How to create a document library under a parent libray by api

How to create a document library under a parent libray by api

2 posts, 0 answered
  1. Ajai
    Ajai avatar
    15 posts
    02 Mar 2015
    27 May 2015
    Link to this post

    Hi all,

    I am working with sitefinity 7.0.

    I am working on creating and uploading document to library by api in sitefinity.

    Suppose I have 2 document libraries say Group1,Group2 under the root
    Default Library.


    How can i upload documents to the library Group1,Group2 under the Default Library.

    I am referring the code here .

    //Set the parent document library.
    DocumentLibrary documentLibrary = librariesManager.GetDocumentLibraries().Where(d => d.Id == parentDocumentLibraryId).SingleOrDefault();
    document.Parent = documentLibrary;

     But ​how can i found the Id of the document library Group1 under Default Library by its name?

     because the librariesManager.GetDocumentLibraries() returns only libraries in root level.

     What i need is the documentLibrary which has name Group1 under parent Default Library.


    Any way to achieve this?





  2. Atanas Valchev
    Atanas Valchev avatar
    414 posts
    04 Jan 2016
    01 Jun 2015
    Link to this post

    When working in the context of hierarchical libraries, only the libraries on the root level are referred to as libraries. Their children are folders( To get all folders in a parent library/folder, you can use the approach described here:

    Atanas Valchev
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered