string username = "***********";
string pwd = "*********";
string siteURL = "**********";
ClientContext context = new ClientContext(siteURL);
Web web = context.Web;
SecureString pass = new SecureString();
foreach (char c in pwd.ToCharArray()) pass.AppendChar(c);
context.Credentials = new SharePointOnlineCredentials(username, passWord);
try
{
KeywordQuery query = new KeywordQuery(context);
query.QueryText = "ContentType:Factura AND PrecoOWSCURR>10000";
query.RowLimit = 10;
query.RowsPerPage = 10;
SearchExecutor search = new SearchExecutor(context);
ClientResult<ResultTableCollection> results = search.ExecuteQuery(query);
context.ExecuteQuery();
foreach (var resultRow in results.Value[0].ResultRows)
{
Console.WriteLine("{0}", resultRow["Title"]);
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
Console.ReadKey();
}
The post Using KeywordQuery with CSOM SharePoint Online appeared first on Blog IT.
Top comments (0)