Posts

Showing posts with the label CSOM

SharePoint Content Search

Content searching in documents write this code snippet in ASP.NET WCF service. public MethodResponse<ClientResult<ResultTableCollection>> SearchDocuments( string text, string token) { MethodResponse<ClientResult<ResultTableCollection>> response = new MethodResponse<ClientResult<ResultTableCollection>>(); UserCredential userCredential = new UserCredential(); try { userCredential = VerifyToken(token); if (userCredential != null ) { _ctx = GetClientContext(userCredential); if (_ctx != null ) { KeywordQuery keywordQuery = new KeywordQuery(_ctx); keywordQuery.QueryText = Convert.ToString(text); SearchExecutor searchExecutor = new SearchExecutor(_ctx); ClientR...

SharePoint People Search

Searching of all user profiles in SharePoint 2013 by WCF CSOM service. In SharePoint for searching users by CSOM can be performed by writing the below code by creating a WCF service. Note:  1. 'MethodResponse' is a custom object to store list of string 2. 'token' is a unique string to verify stored UserCredentials public MethodResponse<List< string >> GetPeoples( string text, string token) { MethodResponse<List< string >> response = new MethodResponse<List< string >>(); List< string > lstMetadata = new List< string >(); UserCredential userCredential = new UserCredential(); try { userCredential = VerifyToken(token); if (userCredential != null ) { _ctx = GetClientContext(userCredential); if (_ctx != null ) { ...