C# CAML query to sharepoint returns all items in the list (instead of only ones that mach query value) -


i have following code in app pull details sharepoint list.

            string siteurl = "http://sharepointurl";          clientcontext clientcontext = new clientcontext(siteurl);         clientcontext.credentials = new networkcredential("un", "pw", "domain");         sp.list olist = clientcontext.web.lists.getbytitle("licences");          camlquery camlquery = new camlquery();         camlquery.viewxml = "<where><eq><fieldref name='account' /><value type='text'>123456</value></eq></where>";          listitemcollection colllistitem = olist.getitems(camlquery);         clientcontext.load(colllistitem);         clientcontext.executequery();          console.writeline("filtered list: " + colllistitem.count.tostring() + "\n");         foreach (listitem olistitem in colllistitem)         {             console.writeline("account: {0} \nlicence: {1} \nmac: {2}\n", olistitem["account"], olistitem["licence"], olistitem["mac"]);         } 

in sharepoint list have created multiple test items every time run above code items in list returned regardless of use camlquery.

can let me know i'm going wrong pretty new c# , never touched sharepoint before this.

edit1: updated advice below.

edit2: simplified code still getting same problem.

the issue last line of code:

textboxreadshow.text = licence + "\t\t" + mac + "\n"; 

you're truncating text in textbox each iteration of loop.

you appear want appending text end of textbox:

textboxreadshow.text += licence + "\t\t" + mac + "\n"; 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -