Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am trying to create a webpart which loads document information from a different application. I want this information loaded into a list which looks like a SharePoint list. I was able to create a list and fill this list with the document information but the list is saved on the sharepoint site. Because i want to keep the data on 1 point i do not want sharepoint to save this list.

I tried creating a SPList() but these cannot be created unless they are created in a SPListCollection.

In short i want a webpart which creates a sharepoint list but does not save the list on the sharepoint site.

I want to use a SPList because of all the functionalities and the design. Using a SPList should save me alot of work. Seeing the current answers i might have been looking for the wrong functions of sharepoint. Basically i want a table/library/list which looks like this: http://4.bp.blogspot.com/_NOYsVRY2y8g/TDm7IEbs1YI/AAAAAAAADcA/hlkyDtaXlkQ/s1600/Screenshot-Shared+Documents+-+All+Documents+-+Mozilla+Firefox+04.png

And be able to add my own column names and datarow to such table/library/list without the need to save it in sharepoint. Is this possible or does Stuart Pegg's answer still apply?

share|improve this question
1  
If you add why you want to load the data into an SPList, you may also get suggestions to help you work around your wider issue. –  Stuart Pegg Dec 13 '12 at 11:43
    
clarified more on why i looked into using a SPList. –  user1746525 Dec 13 '12 at 12:08
    
Please see my edited answer. –  Stuart Pegg Dec 13 '12 at 12:31
add comment

2 Answers 2

up vote 2 down vote accepted

You could use an External List to bring information from outside of Sharepoint. More on how to create external lists here

I totally agree with Stuart (got ahead of me by a few seconds :) ) that you can't have an SPList which is not registered on an SPSite. You should probably tell us more about what are you trying to achieve, why did you think about using an SPList? Couldn't be used instead a List<T> or a DataTable or something like this?

Later edit:

Based on your comments and edited question, I think you should really try the SPGridView control. Check here for a detailed guide on how to implement it. It gives you a data grid which looks like a Sharepoint list. It can give you some head aches, if you want to enable Sorting and Filtering on the columns, but rest assured, it's possible. I know, because I have used it once in a project.

Cheers!

share|improve this answer
    
I am using a DataTable right now and load the datatable into a DataGrid which i add as control for the webpart. What i am looking for is a replacement for the datagrid which look and act like a sharepoint List. –  user1746525 Dec 13 '12 at 12:11
add comment

An SPList object is like a window into data stored in the Content Database. So what you're asking is effectively "Can I have a window without a house"?

In short, the answer is that this isn't possible; you'll need to find an alternative method of holding your data, such as a List of Dictionaries:

List<Dictionary<string, object>> spListLikeStorage = new List<Dictionary<string, object>>();

Or an ID keyed dictionary of dictionaries:

Dictionary<int, Dictionary<string, object>> spListLikeStorage = new Dictionary<int, Dictionary<string, object>>();

Edit: Based on your edits, it sounds like you want to Render the data like a SharePoint list. In which case you may be best off either using External Lists (as Nobert suggests), or look at overriding the List View Web Part, which is used by SharePoint to render the list data.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.