0

Can I use linq in sharepoint online Provider Hosted Apps on office 365 select and join lists?

1 Answer 1

7

You can use Client object model in Sharpoint Online to retrieve.

When you use the CSOM, you can write LINQ queries against client-side objects, such as lists and Webs, and then use the ClientContext class to submit these queries to the server. It's important to understand that when you take this approach, you are using LINQ to Objects to query SharePoint objects, not LINQ to SharePoint. This means that your LINQ expressions are not converted to CAML and you will not see the performance benefits that are associated with CAML conversion.

The LINQ to SharePoint provider is not supported by any of the client-side data access mechanisms.

private IEnumerable<List> newLists;

var dt = new DateTime(2010, 3, 20);
var query = from list
            in clientContext.Web.Lists
            where list.Created > dt && list.Hidden == false
            select list;

newLists = clientContext.LoadQuery(query);
clientContext.ExecuteQueryAsync(onPartQuerySucceeded, onPartQueryFailed);
2
  • what about spmetal tool?
    – eaam
    Jun 15, 2014 at 13:48
  • it is used in on premise version and server object model. For sharepoint online you can only use client object model.
    – Aanchal
    Jun 15, 2014 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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