Tag Info

Hot answers tagged

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 ...


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. ...


8

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 ...


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 ...


5

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> ...


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

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

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 ...


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

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

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

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

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 ...


1

If you use a version of .net that support LINQ you can use the Distinct function after a conversion of your value: var collectionWithDistinctElements = oldArray.Distinct().ToArray(); otherwise you can use the hast table var list = new HashSet<string> { }; list.Add("a"); list.Add("a"); var countItems = list.Count(); //in this case countItems=1


1

I create similar dynamic CAMLQueries in SPServices itself. As much as people say they hate CAML, the reverse notation makes it relatively easy to build fairly complex queries programmatically. If you take a look at the way I build the CAMLQuery for the GetListItem query in SPCascadeDropdown to populate the child column, especially where the parent is a ...


1

Hard to say exactly what you are asking but I am gussing you need to contruct a CAML query with a series of numbers, like a SQL "In" operator. SP2010 has a CAML In operator, which is documented here: http://msdn.microsoft.com/en-us/library/ff625761.aspx In the Community Content section at the bottom, a user has inserted a code example. is this what you're ...


1

It is possible to create a filter based on the current user. If you're defining a ReadItem method, then you can even do this with the wizard in SharePoint Designer. It's a little more tricky if you want to do the same thing with a ReadList method. This blog post goes into great detail about the process of adding a UserContext filter to a ReadList method. ...


1

Follow these steps; Place the standard CQWP onto the page. Export the web part (in the web part pane, click edit -> Export and save the file to your PC) Open the webpart you just exported in Notepad or some other plain text editor Find the property Embed your CAML query into a CDATA section, the above query will now look like this; < ![CDATA[ ...


1

The out of the box paging won't work with a CrossList DVWP. You'll need to come up with a different scheme. I usually do something with script so that the action is all on the client side. If you have a very large number of items that may be prohibitive due to the large page load, but otherwise, it's mouch better UX.


1

If you have control of the property setting code of the web, you could have a quasi "index" in the RootWeb, which contains a csv or a list of webs with property values. Then, to find webs with specific properties, all you need to do is query a property from the RootWeb (which is a property from the SPSite so you don't need to do a search).


1

I am going to cover a few things as I don't know exactly what you're doing here. 1) Create a calculated column to display the first letter of your field using formula - lets call this "FirstLetter" =LEFT([YourFieldName],1) 2) Optionally, you can then use the Group By feature to show a collapsed/expanded list on [FirstLetter] - (see "The By Last Name View" ...



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