More in this section
Forums / Sitefinity SDK / SDK - with Documents

SDK - with Documents

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Julie
    Julie avatar
    1 posts
    Registered:
    14 Feb 2011
    03 Aug 2011
    Link to this post
    Hi,
    from my custom widget I need to create a new document, and I need to select all documents into a specific library.
    Here is my code for the select and it's not working:
                var asset = from p in App.WorkWith().Documents()
                            where p.Library.Title == "Assets"
                            orderby p.Title
                            select p;

    How I can create a new document and listing all documents into a specific library?
    Thanks,
    Julie
  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    18 Sep 2017
    08 Aug 2011
    Link to this post
    Hi Julie,

    Here is how you get list of the documents in a specific library(libraryName)
    publicIContent GetContentItem( stringname )
            {
                IContent content = null;
       
                stringlibraryName = string.Empty;
                libraryName = GetLibraryName();
       
                var docs = from p inApp.WorkWith().Documents()
                           where ( p.Parent.Title == libraryName ) &&
                           ( p.Visible == true) && ( p.UrlName.ToLower() == name.ToLower() )
                           orderby p.Title
                           select p;
       
                docs.LoadAllItems();
                   
                List<IContent> items = newList<IContent>();
       
                foreach( IContent item indocs.Get() )
                {
                    content = item;
                    break;
                }
       
                returncontent;
            }

    To create a document follow the example in the documentation.

    All the best,
    Stanislav Velikov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

2 posts, 0 answered