question

MohammadQasim-1438 avatar image
0 Votes"
MohammadQasim-1438 asked Jerryzy answered

how to write quey ( Sharepoint Client ) to fetch data ,based on where clause

Greetings

Using Sharepoint online to fetch data on asp.net

Issued, its not fetching data based on query ( attached is snap short for reference )

How can I fetch data based on query ,as we usually do in CAML query .

77118-queryallrecords.png


Thanks


office-sharepoint-server-development
queryallrecords.png (63.2 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@MohammadQasim-1438 ,

If the answer is working for this question, I suggest you can accept as answer so that it could also help others who have the same question in the forum :)

Thanks
Best Regards

0 Votes 0 ·
Cloudarijit-8685 avatar image
0 Votes"
Cloudarijit-8685 answered

Hi,
You can try this,
Enclose Where with View and Query,

camlQuery.ViewXml ="<View><Query><Where>rest of your query here</Where> </Query></View>"

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Jerryzy avatar image
0 Votes"
Jerryzy answered

Hi @MohammadQasim-1438 ,

Add <View><Query></Query></View> outside the real caml:

                 CamlQuery caml = new CamlQuery();
                 var id = 1;
                 caml.ViewXml = "<View><Query><Where><Eq><FieldRef Name='ID'/><Value Type='Counter'>"+id+"</Value></Eq></Where></Query></View>";
                 ListItemCollection items = list.GetItems(caml);
                 ctx.Load(items);
                 ctx.ExecuteQuery();

Thanks
Best Regards



If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Jerryzy avatar image
0 Votes"
Jerryzy answered

@MohammadQasim-1438 ,

Is there any update ? Did the answer solve the question ?

Thanks
Best Regards

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.