Accessing a List on demand using SharePoint WebService - sharepoint

I am able to access a Site then Lists inside the Site and then List Items inside all the Lists. This works fine when I want to crawl/access all the Items in a Site.
I am keen to know if there is a way through which we can directly access a List in a Site. To elaborate on this :: If I have 1000 sites and 1000 documents then I would have to go through 1999 items at the worst before finding the one I want.
Any help/suggestion on this would be greatly appreciated.
Thanks

Try using an SPSiteDataQuery to get what you need. There are many ways to develop the CAML query you want such as CAML Query Builder.
This is the best way to avoid trolling through all Webs->Lists->ListItems to find items.
I prefer to limit the SPSiteDataQuery to one site collection and call the query for each site collection that is relevant as there are some limitations to the SPSiteDataQuery.
The equivalent for webservices would be the GetListItems in the SiteData webservice

Related

List of documents in Entire Sharepoint Site

I am trying to get a list of all documents within my SharePoint Site, owner and date last modified.
It is a SharePoint 2010 Enterprise environment.
It's a site which has many subsites.
All solutions I have tried only allow me to get documents at that specific site level and not subsites.
I must admit, I can get the required information by querying the SQL DB directly but don't want to go down this path, as it's unsupported by MS
Any help would be appreciated.
You can get this information quite easy by using Powershell, you just need to iterate through all subsites and document libraries.
Take a look at these pages:
http://blog.falchionconsulting.com/index.php/2010/08/getting-an-inventory-of-all-sharepoint-documents-using-windows-powershell/
(This is almost exactly what you require, there are a few extra lines that you don't need).
http://www.sharepoint-journey.com/get-all-document-libraries-in-a-site-collection.html
https://sharepoint.stackexchange.com/questions/126397/powershell-get-a-list-of-all-the-document-libraries-for-a-web-application-incl
http://blogs.msdn.com/b/varun_malhotra/archive/2012/02/08/sharepoint-2010-powershell-download-all-files-in-document-library-to-network-share-file-share.aspx

Query a specific list template with a web application scope

I know that is is possible to query a specific site collection using the SPSiteDataQuery but I would like to perform the same operation within a whole web application. In fact, I would like to query a specific list template in a whole web application.
I could loop over the site collections of the web application but it is really too much time consuming.
Does anybody have an idea ?
You might like to try doing it via a search solution instead?
This depends on whether you have a content type or other property to search on, but it will scope to web applications much better.

SharePoint - Using a Content Query Webpart across site collections

This is quite a simple question to ask, hopefully the answer is as straight forward! Can you use a Content Query Webpart on Site Collection A to read data from Site Collection B?
If it's not supports right out of the box, are there some configuration options which you can use to make it happen?
Thanks.
No configuration option will enable you to have a cross site content query webpart.
You can either create a custom web part that will do it or buy one (several options out there, here is one
If you decide to create your own web part, you will easily find code online that will help you. Here is an example.
No, it must be within the same site collection as it uses the SPSiteData query, which works within the site collection

Create a List (url links) and deploy it as a feature

I'm very new to SharePoint, so apologies if this sounds a little basic.
I want to create a List in SharePoint that is just purely URL links, but then make it available to every site collection that we will create.
Once this list is created, I need it to display in a webpart (like that standard 'links' webpart). I guess I will need to create a Feature, so that it can be activated at Site Collection level.
Any ideas how this can be achieved please?
Thank you all kindly in advance, Ash ;-)
I did something similar - but I created it as a Web Part with it's own security trimming. I covered some of the basics here:
http://www.codersbarn.com/?tag=/webpart
What you would need is a view on your list of links (that view will display the content of your list). Have a look here for more details on List View Web Parts. Once you figure out how to create it and what you want in your view, coding it shouldn't be too hard (You can either use SharePoint Designer on your site to create the view you want and then reverse engineer it into code using SPSource or you can create it from the schema.xml of you list).
You should note however, that with WSS you will not be able to view the content of a list on another site collection (i.e. you can only views of your list on the site collection where the list was created). Cross-site list views are a lot more complex to implement (you can buy components that do it though). I'm not sure how MOSS deals with cross-site list views but if you use MOSS, you should make sure that you can do it before you start developing your view.
EDIT : I would definitely go with what IrishChieftain suggested if your list isn't too complicated and has a structure that won't change much. Dealing with cross-site list views is a pain.

How to query data in SharePoint from multiple lists

I have multiple SharePoint lists and want to display data from them on to a gridview control.
Please guide me.
Grace
Your question inspired me to develop a web part that demonstrates:
How to query SharePoint data in the many ways offered by the API, and
How to bind it to a grid view.
It can be found on CodePlex here. Some of it is a little rough but it should be enough to show you the basics. It demonstrates the following query types:
For loop (if that counts)
GetListItems from Lists web service
SPQuery for SPList objects
SPSiteDataQuery for cross-site list queries
CrossListQueryInfo for cached cross-site list queries
PortalSiteMapProvider for SharePoint Server publishing sites only
There is code for using the search engine but this isn't wired up to the web part itself yet.
I hope it helps you. If you try it and have problems please use the CodePlex site to get support from me.
Two options that I can think of:
SPSiteDataQuery
Set up a search scope, metadata, and then query your Scope using Enterprise Search SQL and FullTextSqlQuery
With SharePoint 2007 you can use CrossListQueryCache and CrossListQueryInfo. More information here.

Resources