Tag Info

Hot answers tagged

10

Try to use this caml: <Where> <Eq> <FieldRef Name="Author" LookupId="True" /> <Value Type="User">123</Value> </Eq> </Where> this also might work, but first is preferable: <Where> <Eq> <FieldRef Name="Author" LookupId="True" /> <Value Type="Lookup">123</Value> ...


10

AFAIK there is no way to query SharePoint using SQL syntax. You have the following options: Use CAML Use the REST services (_vti_bin/ListData.svc) Use the SharePoint web services Use Search (Search has a SQL like syntax) Some custom stuff that "exports" your data (using method 1-4) to a queryable SQL db I think your best option are #2 - the REST/OData ...


9

It is more a caml question than an SPServices question. Often one uses or and and operators to combine multiple values, which, like @rjcp3 said, can be messy. There is another operator, less known, IN operator to choose a range of values (see the xml example below). To simplify the creation of CAML queries in javascript, I'd recommend SharePoint ...


8

Definitely don't want to go the SQL query route because you can easily create an ineffecient query if you don't understand the underlying data model...also possible that you'll develop a query that breaks or becomes inefficient after a CU or SP is applied. CAML queries are very efficient and depending on the scope of your query you have a lot of options. ...


6

if you can use the same content type across multiple libraries, then you can create a Search Scope ( for the content type scoped @ site collection OR web application level) and user search.asmx or Object model for search API. Search API once indexed queries really fast.


5

You should use the Internal Name of the column, so its probably: Link_x0020_to_x0020_Page Easy way to check the internal name is from the url when you edit the column, and check the "Field=" part of the URL: FldEdit.aspx?List=%7B6045095F%2DC5AF%2D47D5%2DA481%2D27665B46E343%7D&Field=Link%5Fx0020%5Fto%5Fx0020%5FPage Replace %5F with underscore, or ...


4

If you use CAML to get list items (which is the fastest way of retrieving items), it is just enough to get ids of items to be able get the count: //some query var title = "<Eq><FieldRef Name='Title' /><Value>task 00001</Value></Eq>"; var q = "<Where>" + title + "</Where>"; var lst = web.Lists["Tasks"]; var query = ...


4

Using SharePoint SQL directly is not supported by Microsoft, so for example the internal structure may change in an update, which may break your query and you will be left to fix it alone. Any updates to the database(s) and Microsoft will no longer provide support for your farm. You can easily use SharePoint list data in SQL Server Reporting Services by ...


4

You can use PageQueryString and/or PageFieldValue in the CQWP. Here is an exmaple


4

For SPQuery, use SPQuery.Folder to define the folder: SPFolder folder = list.RootFolder.SubFolders["Folder 1"]; SPQuery query = new SPQuery(); query.Folder = folder; Then, to define content type, you should include the following condition into your Where clause: SPContentType contentType = list.ContentTypes["MyContentType"]; query.Query = ...


4

You need to retrieve SPWebApplication.DaysToShowNewIndicator and the build a query to retrieve documents created within that number of days. For more code see Getting the list of new items from code


3

Jup, there is a way - with calling Method GetListAndView


3

I found this to be the easiest way... SELECT * FROM OPENROWSET ('Microsoft.ACE.OLEDB.12.0', 'WSS;IMEX=1; DATABASE=http://portal/sites/Team/;LIST=On Call;VIEW=;RetrieveIds=Yes;', 'SELECT * FROM LIST') You'll need Microsoft Access Database Engine 2010 installed. Here's the URL http://www.microsoft.com/en-us/download/details.aspx?id=13255 Here's a ...


3

Probably you're looking for the SPList.Fields.GetFieldByInternalName method. This will allow you to get the field by it's internal name, like this: foreach (string fieldName in list.Views['Viewname'].ViewFields) { var field = list.Fields.GetFieldByInternalName(fieldName) // do whatever you need with SPField object }


3

Strategies for accomplishing this query while working around the constraints: Shorten your query: Do you really need to update 5k records at the same time? Prefer to reduce updates to those actually being changed. If still too big for a successful update then you can break up the records and only update 1k at a time. Change your connection method from ...


3

Your code is fine. Url is property of the item and its not affected by your parameter in GetItems. Test with a field (not property) that is not included in the parameter you pass in GetItems. item["OtherField"] Normally it should throw an exception (ArgumentException).


3

When you request list items via client object model, the object will return a number of parameters even if you specify none at all. Some of these include title, url, modified date, created date, check out user, etc. You can see these by storing the object as a variable and then using Dev tools to debug the page. You will see there are actually about a dozen ...


3

Use the following code: using(SPSite site = new SPSite("http://example/site/")) { using (SPWeb web = site.OpenWeb()) { SPWebCollection webCollection = web.GetSubwebsForCurrentUser(); foreach (SPWeb web in webCollection) { if (web.Properties["SiteCategory"] == "SomeCategory1") {} ...


3

The way you are fetching items from the list is perfectly acceptable. As an alternative (not necessarily a better alternative, but more flexible), would be to use AJAX and SharePoint Web Services. One thing to note, is there isn't any way to call SP.ClientContext.executeQueryAsync in a loop and retrieve the results. For example, suppose you wanted to loop ...


2

I think you can proceed by using SPSiteDataQuery. You can define its object and sets its properties to query libraries within a web and its child webs. SPSiteDataQuery q = new SPSiteDataQuery(); q.Lists = "<Lists BaseType='1'/>"; q.Query = "<Where><Gt><FieldRef Name='ID' /><Value ...


2

You can use a Data View Web Part with DataSourceMode="Crosslist" for this if you're looking for a "non-code" solution. You can also use the Web Services themselves. Here's an example.


2

SPFields are defined at the list level, not to an individual view or query. Instead of list.Fields[viewfield], try this : list.Fields.GetFieldByInternalName(viewfield) more info : http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfieldcollection.getfieldbyinternalname.aspx


2

That field only applies to pages that are/were published on a scheduled date and time and it should be empty for Pages that are published immediately.


2

If you want to use a tool that exposes various properties of the SP object model (basically allows you explore all of the sites' fields, lists, content types, and other nitty gritty) and you don't want to have to return to sites like this to discover the next magical method, you really ought to try installing SharePoint Manager 2010 http://spm.codeplex.com/ ...


2

This is in fact possible with the OOTB paging. I found the solution by accident while working on a CrossList DVWP. The origin to the problem is changes that are made to several variables in the DVWP, probably by SPD when turning it into CrossList mode. An Easy way to get the paging working again is by adding the Grouping toolbar to the dataview from the ...


2

The XSLTListViewWebPart can read querystring parameters, you could try this: .../Forms/AllItems.aspx?FilterName=Title&FilterMultiValue=*something* FilterName is a column. Hope this helps


2

According to msdn article you posted it looks like it is hard limit. Can you split long query into multiple smaller and merge results?


2

For a such scenario the following approaches could be considered: Override Query [ToolboxItemAttribute(false)] public class MyAggregatedDocuments : Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart { protected override void ConfigureDataSourceProperties() { // only perform actions when we are trying to ...


2

Use CAML, it will give you better performance. You should skip the <Query> And </Query> From your SPQuery.Query, so just start with <OrderBy> So query.Query = "<OrderBy><FieldRef Name='Sequence Number' /></OrderBy>"


2

By changing the CAML like this: string where = @"<Where> <And> <BeginsWith> <FieldRef Name='ContentTypeId'/> <Value ...



Only top voted, non community-wiki answers of a minimum length are eligible