0

I'm trying to find documents in Sharepoint uploaded by a specific user. So that user can fill in a username and get the related documents. i got the form working, now I need to search through all uploaded documents, filter it and present it.

This is what i all ready got:

        using (SPSite site = new SPSite(SPContext.Current.Site.Url))
        {

            using (SPWeb web = site.OpenWeb())
            {
                SPFolder library = web.Folders["Shared Documents"];
                grvUsers2.DataSource = library;
                grvUsers2.DataBind();

            }

        }

I've uploaded a couple documents to Sharepoint, but in the code above i don't see them. What am I doing wrong?

By the way I'm building a webpart in C# for a teamsite in Sharepoint 2013.

apero
  • 1,074
  • 2
  • 23
  • 38
  • What have you tried? What is your current query code look like? SharePoint offers a variety of ways to query data with or without a filter. You're more likely to get a helpful answer if you provide more detail of what you've tried and, if possible, a code sample. – Stevangelista Jun 11 '14 at 12:54
  • actually its my first webpart and I never worked with Sharepoint so I have no idea how to achieve. So I have only tryed to Google for a couple hours now, but it doesnt help. Can you tel me a couple ways i can try? – apero Jun 11 '14 at 12:59
  • Unfortunately then, this may be far too broad a topic/request for a StackOveflow question. I suggest you start with this blog post which covers the 6 ways you can query for data in SharePoint 2013: http://wmostafaw.wordpress.com/2012/12/21/how-to-read-from-sharepoint-2013-list-in-6-ways/. Best of luck! – Stevangelista Jun 11 '14 at 13:08
  • Thank you very much for the link, it helped me a lot and now I'm stuck again. Can you take a look to my question again? I've edited it. – apero Jun 12 '14 at 07:13

0 Answers0