Tag Info

Hot answers tagged

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

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


6

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


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


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

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


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

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


2

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


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

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


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


1

You can review the list of search operators in this article but there isn't one that will let you pass multiple values for one property. You can however remove the OR to save some space. When you use multiple instances of the same property restriction, matches are based on the union of the property restrictions in the KQL query. Matches would include ...


1

The scope of the rule: If you define them in the search service, its valid for all webapplications associated with that search service. If you define it on subsite/web level, its valid for the contextual search made on that site. If you define it on site collection its valid for the site and all subsites.


1

It could be achieved by generating url for the asset on the client side and passing it to iframe for displaying asset content in Content Editor web part. Usage Clear ContentLink property Put in Content property of the following code: <iframe width="100%" id="assetContent" frameborder="0"></iframe> <script type="text/javascript"> ...


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

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

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


1

I wrote a query which allows to delete list and documents. You could base your query on this by replacing the "delete" by "Select". Pay attention, it is not a good idea to directly querying SQL. The query is available at URL http://sharepointtips2012.blogspot.be/2012/10/delete-library-and-documents-directly.html


1

You have to make sure the column which holds the duplicate value is of type integer. Columns or site columns created via SharePoint UI is of type Decimal. You can perfectly well map a decimal type crawled property to an integer type managed property, but it just won't work. And there is no error given. So either create an integer site column which you add ...


1

After hours and hours of searching and debugging I finally found out what the problem was: Somebody had removed read/write access from the user I created in SQL Server. When checking Read/Write boxes everything works fine again. If you want to learn about BCS: Take a look at this video about Business Connectivity Services Thanks.


1

Try this: $web.Lists["Site Assets"].Folders | where { $_.Name -eq "Calendar Pages" } $web.Lists["Site Assets"].Lists["Calendar Pages"] does not work because "Calendar Pages" is not a List, it's a folder. $web.Lists["Site Assets"].Folders["Calendar Pages"] does not work because $web.Lists["Site Assets"].Folders is of type SPListItemCollection which does ...


1

For SharePoint 2010, I'd recommend using the Client Object Model. It allows for development without having to resort to installing SharePoint on the developer's PC (or developing ON the SharePoint server). http://msdn.microsoft.com/en-us/library/ee857094.aspx


1

You can query data from SharePoint using various approaches as mentioned below. SPList.GetItems with a SPQuery object that will return you a SPListItemCollection object SPList.Items.GetDataTable. You can assign a DataView to the DataTable that you receive and filter based on your requirements. SharePoint also has OOB webservice known as Lists.asmx ...



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