Link to home
Start Free TrialLog in
Avatar of hansbla
hansbla

asked on

create Document Library Views programmatically

Hi,

For one of our intranetsites, I have to create a knowledge management webpart on a Sharepoint site. Sharepoint is pretty new in our organisation and I'm still learning the ins and outs of it all.

So far users can choose from a selection of search criteria and then a SPgridview is created with the desired information. SPgridviews have a wonderfull option of creating a dropdown menu so you can perform some additional actions to the results in de SPGridview.

One of the options I want to give is the following:
The gridview displays a number of projects and some basic information. The project number has the SPmenu with three options: Edit the selected project, view the resources of the project and show the document library linked to the project number.
I already programmed the first two options, but the document library option is very different from these.

I have setup a document library with an additional column for the Project number.
Is it possible to get a document library view from a single project programmatically ?
I really would like to retain all the functionalities and workflows a SP doc lib provides. There's no sence it trying to reproduce this in code when Sharepoint already provides this.

Some sites give possibilities to get the list of documents in the library, but I really would like to have the document library view.

Can this be done ? And if so, how ?

Thanks.


Avatar of rich_0794
rich_0794
Flag of United States of America image

Just create a custom view in your document library and sort by the Project number column.  To create a custom view in the document library or list select the drop down box beside View and select Create a View
Avatar of hansbla
hansbla

ASKER

Thanks for your answer.

But I want to to prevent that users have to create their own views every time they want to use the documents from a single project. There are quite a few projects which increase every day.

The users having to select that view every time, isn't very efficient and defeats my purpose for this site.

Isn't there a way to filter the results from a view automaticall?. I.e. The user selects the project from said gridview and the selection links to the document view showing only the documents from the selected project.
You can edit your default fiew to sort by the project number.  
Select View > Modify this view > and then scroll down to the Filter section.  here you can add your custom filtering.
ASKER CERTIFIED SOLUTION
Avatar of hansbla
hansbla

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial