Sharepoint 2013 client object model FQL

Hi,
Im using Sharepoint 2013 client object model api and im trying to search on sharepoint by using FQL, but I dont get any results when Im using FQL, but when Im trying similar KQL syntax I get results.
I''ve heard that I need to enable the FQL but I can't find how, In 2010 api its a proeprty in KeywordQuery class.
code:
KeywordQuery keyword = new KeywordQuery(client);
// KQL
keyword.QueryText = "title:mon*";
// FQL
keyword.QueryText = "starts-with(title:string("mon"))";
Thank you

To enable FQL, you have to copy the default result source and modify the Query Transformation string {?{searchTerms} -ContentClass=urn:content-class:SPSPeople}, at one of these
levels -- Search Service Application (SSA), Site Collection, or Site -- and in one of the following ways:
Remove the KQL filter, -ContentClass:urn:content-class:SPSPeople, from the Query Transformation. The resulting Query Transformation string will be: {?{searchTerms}}
Replace the Query Transformation string with an FQL equivalent, such as {?andnot({searchTerms},filter(contentclass:"urn:content-class:SPSPeople*"))}.
Source :http://msdn.microsoft.com/en-us/library/office/jj163973.aspx
Bala

Similar Messages

  • SharePoint 2013 Client Object Model fetch image rendition info

    Hi,
    Below is the scenario I am trying with SharePoint 2013 managed client object model.
    FrontEnd: ASP.Net web application
    BackEnd: SharePoint 2013.
    I have a publishing image with rendition applied and I am able to fetch the image URL like "/{site}/{lib}/{imagename}?RenditionId={id}".
    I am able to download the file "/{site}/{lib}/{imagename}" using File.OpenBinaryDirect() 
    This is giving the original file without any renditions applied. If I use the same method with URL "/{site}/{lib}/{imagename}?RenditionId={id}", it gives me 400 Bad request error.
    I have also tried using file.OpenBinaryStream() method with URL "/{site}/{lib}/{imagename}?RenditionId={id}" whichi still gives the original file without rendition
    Please let me know how to fetch the below info using the rendition id?
    RenditionVersion;
    SourceImageWidth;
    SourceImageHeight;
    CropStartX;
    CropStartY;
    CropWidth;
    CropHeight;
    Alternatively, let me know if I could get the download file with rendition applied without requiring the above attributes.
    Note: I am looking for solutions in client side programming (client object model/ web services (REST) .  The server object model has classes "ImageRenditionCollection" and "ImageRendition" which can provide the above image info.
    Thanks,
    Srikanth

    To enable FQL, you have to copy the default result source and modify the Query Transformation string {?{searchTerms} -ContentClass=urn:content-class:SPSPeople}, at one of these
    levels -- Search Service Application (SSA), Site Collection, or Site -- and in one of the following ways:
    Remove the KQL filter, -ContentClass:urn:content-class:SPSPeople, from the Query Transformation. The resulting Query Transformation string will be: {?{searchTerms}}
    Replace the Query Transformation string with an FQL equivalent, such as {?andnot({searchTerms},filter(contentclass:"urn:content-class:SPSPeople*"))}.
    Source :http://msdn.microsoft.com/en-us/library/office/jj163973.aspx
    Bala

  • SP 2013 Client Object Model: What credentials to use for Office 365 and sites behind ADFS 3.0?

    I'm using the SharePoint 2013 Client Object Model to access a site that is either in Office 365 or behind an ADFS 3.0 login screen, is it sufficient to use the new SharePointOnlineCredentials credentials
    or do I need other types of credentials for the sites behind ADFS 3.0 ? Is so, what type of credentials would I use for the sites behind ADFS 3.0?
    using (ClientContext ctx = new ClientContext(siteUrl))
    ctx.Credentials = new SharePointOnlineCredentials("some user", "a secure string password");
    while (ctx.HasPendingRequest)
    ctx.ExecuteQuery();
    // etc.

    Hi,
    According to your post, my understanding is that you want to know the ways to get credential either in Office 365 or sites behind ADFS 3.0.
    For Office 365, you can use SharePointOnlineCredentials Object to get credential. For SharePoint sites behind ADFS 3.0, you can use NetworkCredential Object:
    ctx.Credentials = new NetworkCredential(UserName, Password, Domain); 
    The link below will provide more information about using the ADFS FedAuth Token programmatically through the SharePoint Client Object Model:
    http://samirvaidya.blogspot.com/2013/05/using-adfs-fedauth-token.html
    Best regards
    Patrick Liang
    TechNet Community Support

  • Create folder in Document Library using Sharepoint 2010 Client Object Model

    I would like to check for the existence of a folder in s Sharepoint 2010 Document Library and if the folder is not found, create it. (I would then subsequently programmatically upload documents to that folder -- which I have figured out). Can someone
    please help me figure out how to check for the extistence of and then create a folder using the Sharepoint 2010 Client Object Model?

    You can use this:
    public static void CreateFolder_ClientOM(string listName, string folderName)
    ClientContext clientContext = new ClientContext("http://basesmc2008");
    Web web = clientContext.Web;
    List list = clientContext.Web.Lists.GetByTitle(listName);
    clientContext.Load(clientContext.Site);
    string targetFolderUrl = listName + "/" + folderName;
    Folder folder = web.GetFolderByServerRelativeUrl(targetFolderUrl);
    clientContext.Load(folder);
    bool exists = false;
    try
    clientContext.ExecuteQuery();
    exists = true;
    catch (Exception ex)
    if (!exists)
    ContentTypeCollection listContentTypes = list.ContentTypes;
    clientContext.Load(listContentTypes, types => types.Include
    (type => type.Id, type => type.Name,
    type => type.Parent));
    var result = clientContext.LoadQuery(listContentTypes.Where
    (c => c.Name == "Folder"));
    clientContext.ExecuteQuery();
    ContentType folderContentType = result.FirstOrDefault();
    ListItemCreationInformation newItemInfo = new ListItemCreationInformation();
    newItemInfo.UnderlyingObjectType = FileSystemObjectType.Folder;
    newItemInfo.LeafName = folderName;
    ListItem newListItem = list.AddItem(newItemInfo);
    newListItem["ContentTypeId"] = folderContentType.Id.ToString();
    newListItem["Title"] = folderName;
    newListItem.Update();
    clientContext.Load(list);
    clientContext.ExecuteQuery();
    Blog | SharePoint Field Notes Dev Tool |
    ClassMaster

  • How to update actual assignments in project server 2013 client object model

    hi sir ,
    I try to update actual assignment using client object model 2013.. but i am not able to do it and hoe to use statusing assignment in csom model of 2013.
    vijay

    Hi,
    Basically ProjectOnline CSOM authentication is the same as SharePoint (or Office365) so you will want to review the TechNet info on that:
    Three authorization systems for apps for SharePoint 2013
    Depending on your App type and specific requirements.
    If however you want to do something like Delegation of a specific Project Online user (as you could in the past), then you're out of luck as that is not supported in the client object model.
    HTH,
    Martin Laukkanen
    Nearbaseline blog - nearbaseline.com/blog
    Bulk Edit and other Apps - nearbaseline.com/apps

  • Sharepoint authentication Client object model for direct links

    We have a Sharepoint 2010 site and another website [ASP.Net Web API 2] which uses Client object model to get data from Sharepoint, this is an intranet environment.
    The Client object model part of it is working fine, if any user logs in, it works with that user credentials. But when a user tries to access a direct SP link, ex: a link to a document from a document library, it pops up a credentials window.
    How to get rid of this pop up window, or how to set the authentication for the entire server when the user logs in to our web api.

    Hi,
    The prompt for credential can be seen as a behavior by designed for the sake of safe and there are no solutions to avoid it at this moment per my knowledge. 
    Here is a similar thread will provide more information:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/85b5d22a-88ed-4975-8de9-1d65df293aeb/avoiding-prompting-for-authentication-when-accessing-the-aspx-page-in-layouts-folder-from-my?forum=sharepointdevelopmentprevious
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Patrick Liang
    TechNet Community Support

  • SharePoint 2010 client object model read survey list

    Hello all,
    please suggest me how to read
    questions and answers in a survey list using
    client object model
    if possible some code is fine.
    Like Cricket

    Hi,
    below is the code for reading the items from survey list in .Net managed client object modal share point 2010
    using (ClientContext context = new ClientContext("siteUrl"))
                    context.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
                    Web web = context.Web;
                    context.Load(web);
                    List survey = web.Lists.GetByTitle("SurveyListName");
                    FieldCollection fldColl = survey.Fields;
                    context.Load(fldColl);
                    ListItemCollection coll = survey.GetItems(CamlQuery.CreateAllItemsQuery());
                    context.Load(survey);
                    context.Load(coll);
                    context.ExecuteQuery();
                    //Load the questions and answers in the dictionary object
                    Dictionary<string, List<string>> questionAnswers = new Dictionary<string, List<string>>();
                    foreach (Field fld in fldColl)
                        if (fld.FieldTypeKind == FieldType.Choice && !fld.FromBaseType)
                            foreach (ListItem item in coll)
                                if (item.FieldValues.ContainsKey(fld.InternalName))
                                    string value = item.FieldValues[fld.InternalName].ToString();
                                    if (!string.IsNullOrEmpty(value))
                                        if (!questionAnswers.ContainsKey(fld.Title))
                                            List<string> values = new List<string>();
                                            values.Add(value);
                                            questionAnswers.Add(fld.Title, values);
                                        else
                                            List<string> oldValues = questionAnswers[fld.Title];
                                            oldValues.Add(value);
                                            questionAnswers[fld.Title] = oldValues;
    Thanks,
    Anil
    Anil

  • Cannot create list in SharePoint 2010 using Client Object Model

    I am trying to utilize SharePoint 2010 Client Object Model to create a List based on a custom template. Here's my code:
    public void MakeList(string title, string listTemplateGUID, int localeIdentifier)
    string message;
    string listUrl;
    List newList;
    Guid template;
    ListCreationInformation listInfo;
    Microsoft.SharePoint.Client.ListCollection lists;
    try
    listUrl = title.Replace(spaceChar, string.Empty);
    template = GetListTemplate((uint)localeIdentifier, listTemplateGUID);
    listInfo = new ListCreationInformation();
    listInfo.Url = listUrl;
    listInfo.Title = title;
    listInfo.Description = string.Empty;
    listInfo.TemplateFeatureId = template;
    listInfo.QuickLaunchOption = QuickLaunchOptions.On;
    clientContext.Load(site);
    clientContext.ExecuteQuery();
    lists = site.Lists;
    clientContext.Load(lists);
    clientContext.ExecuteQuery();
    newList = lists.Add(listInfo);
    clientContext.ExecuteQuery();
    catch (ServerException ex)
    Now, this particular part, newList = lists.Add(listInfo); clientContext.ExecuteQuery();, the one that is supposed to create the actual list, throws an exception:
    Message: Cannot complete this action. Please try again.
    ServerErrorCode: 2130239231
    ServerErrorTypeName: Microsoft.SharePoint.SPException
    Could anyone please help me realize what am I doing wrong? Thanks.

    I've made progress - well, at least to some extent. The previous message related to the "Invalid file name" is not appearing any more. I now realize that it is necessary to specify feature ID, list template kind, as well as custom schema in order
    to order SharePoint 2010 to create the document library. 
    However, there's a new problem which isn't documented on the net almost at all (at least I was unable to find anything): The document library gets created, but I cannot access it. Further inspection showed that the doc lib views are not created. Basically,
    the only accessible doc lib page is the document library settings page. Also, I get the server exception with the message: 
    Server Out Of Memory. There is no memory on the server to run your program. Please contact your administrator with this problem.
    Any idea what is causing this issue? Thanks. 
    Hi Boris
    Borenović,
    I think I found the reason for this notorious "Server Out Of Memory" error.
    (Man, it took 4 hrs of frustrating troubleshooting without any direct hints... very disappointing
    MSFT developers :( ).
    Anyway,
    All the "Form" elements at the bottom need to have SetupPath="pages\form.aspx"
    attribute (by default this attrib is missing when you copy the whole List element from inside the stp's manifest.xml  file).
    Also, just make sure that each "View" element has correct "WebPartZoneID", "SetupPath" and "Url" attribute values otherwise that list/library will
    be created successfully but will fail to load when you try to access it (with the VERY helpful "Cannot complete this action, contact administrator" error). Even if you enable stack trace (or check ULS logs) you will find "An unexpected
    error has been encountered in this Web Part.  Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe." and you will never realize it's because of the
    incorrect attributes ("WebPartZoneID", "SetupPath" or "Url" as mentioned above).
    Come on Microsoft, you can do better than that?
    If the API needs this attrib then why is it missing inside the manifest.xml file when
    an STP file generated in the first place?

  • Client Object Model Sharepoint 2010

    We are using client object model in sharepoint 2010
    When we excute the ExcuteQuery method of clinet obejct model we are getting following error
    The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again
    Girish

    Hi ,
    A FormDigest control has to be included to create a digest for security validations when performing some modifications to SharePoint data. It adds a security token inside your page based on user, site and time. Once the page is posted back the security token
    is validated. Once the security token is generated it’s valid for a configurable amount of time. 
    for more info check the below links
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.formdigest.aspx
    http://ranaictiu-technicalblog.blogspot.com.au/2010/02/sharepoint-2010-client-object-model-for.html
    if above link is not working, use below function before execute the query.
    function CustomUpdateFormDigest()
    if(window._spPageContextInfo != null)
    var $v_2 = window._spPageContextInfo;
    var $v_3 = $v_2.webServerRelativeUrl;
    var $v_4 = window._spFormDigestRefreshInterval;
    UpdateFormDigest($v_3, $v_4);
    CustomUpdateFormDigest();
    Please mark it as an answer/helpful if it is useful.
    Thanks
    Mahesh

  • Unable to get the SharePoint 2013 List names using Client object model for the input URL

    Please can you help with this issue.
    We are not able to get the SharePoint 2013 List names using Client object model for the input URL.
    What we need is to use default credentials to authenticate user to get only those list which he has access to.
    clientContext.Credentials = Net.CredentialCache.DefaultCredentials
    But in this case we are getting error saying ‘The remote server returned an error: (401) Unauthorized.’
    Instead of passing Default Credentials, if we pass the User credentials using:
    clientContext.Credentials = New Net.NetworkCredential("Administrator", "password", "contoso")
    It authenticates the user and works fine. Since we are developing a web part, it would not be possible to pass the user credentials. Also, the sample source code works perfectly fine on the SharePoint 2010 environment. We need to get the same functionality
    working for SharePoint 2013.
    We are also facing the same issue while authenticating PSI(Project Server Interface) Web services for Project Server 2013.
    Can you please let us know how we can overcome the above issue? Please let us know if you need any further information from our end on the same.
    Sample code is here: http://www.projectsolution.com/Data/Support/MS/SharePointTestApplication.zip
    Regards, PJ Mistry (Email: [email protected] | Web: http://www.projectsolution.co.uk | Blog: EPMGuy.com)

    Hi Mistry,
    I sure that CSOM will authenticate without passing the
    "clientContext.Credentials = Net.CredentialCache.DefaultCredentials" by default. It will take the current login user credentials by default. For more details about the CSOM operations refer the below link.
    http://msdn.microsoft.com/en-us/library/office/fp179912.aspx
    -- Vadivelu B Life with SharePoint

  • Advantages and Disadvantages of Client Object Model in sharepoint 2013

    I need Advantages and Disadvantages of Client Object Model in sharepoint 2013
    like below in javascript. Users will have read/edit and approve access to the list.
      var clientContext = new SP.ClientContext.get_current();
           var oList = clientContext.get_web().get_lists().getByTitle('Workflow Tasks');
    MCTS Sharepoint 2010, MCAD dotnet, MCPDEA, SharePoint Lead

    Thanks 
    AlexanderShelopukho for
    right answer!
    Alex-
    I do not need comparison- 
    I need Advantages and Disadvantages of Client Object Model in sharepoint 2013
    MCTS Sharepoint 2010, MCAD dotnet, MCPDEA, SharePoint Lead

  • SharePoint 2013 Client Side Object Model Javascript

    Hi,
    I am using Javascript Client Object Model in SharePoint 2013. What i am trying to do is:
    retrieve items from a particular list which exist on an another site collection. However, the Items that I want to retrieve will be based on particular value in the current site's list where I am writing the script.
    So for eg: I have a sharePoint list called "project status" in site A with project name (hyperlink URL field)  and project status as Managed metadata fields as two fields.
    I have site B where I have  "projects" list with Project name as the URL field. what I want to do is compare the project URL name in Projects list in site B to the Project name  URL in Project status list in Site A and retrieve the status
    so I can do a dashboard in site B using the same status in Site A

    Hi Cooltechie1234,
    You can filter the list item using CAML Query firstly and then set the managed metadata field label using JavaScript Client Object Model.
    If you have trouble in CAML Query, I suggest you can use CAML Designer to figure it out.
    More reference:
    http://cann0nf0dder.wordpress.com/2013/04/10/search-caml-query-with-managed-metadata/
    http://sharepoint.stackexchange.com/questions/113146/how-do-you-properly-write-to-a-managed-metadata-column-from-jsom-sharepoint-20
    http://www.vrdmn.com/2012/12/working-with-taxonomy-and-javascript-in.html
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • How to change 'Modified By' column value when a new file is uploaded in SharePoint 2013 using Client Object Model?

    I want to change 'Modified By' column value of a file that is being uploaded using Client Object Model in SharePoint 2013. The problem is that the version of the file is changing. Kindly help me. The code that I am using is:
    using (System.IO.Stream fileStream = System.IO.File.OpenRead(m_strFilePath))
        Microsoft.SharePoint.Client.File.SaveBinaryDirect(m_clientContext, str_URLOfFile, fileStream, true);
        Microsoft.SharePoint.Client.File fileUploaded = m_List.RootFolder.Files.GetByUrl(str_URLOfFile);
        m_clientContext.Load(fileUploaded);
        m_clientContext.ExecuteQuery();
        User user1 = m_Web.EnsureUser("User1");
        User user2 = m_Web.EnsureUser("User2");
        ListItem item = fileUploaded.ListItemAllFields;
        fileUploaded.CheckOut();
        item["UserDefinedColumn"] = "UserDefinedValue1";
        item["Title"] = "UserDefinedValue2";
        item["Editor"] = user1;
        item["Author"] = user2;
        item.Update();
        fileUploaded.CheckIn(string.Empty, CheckinType.OverwriteCheckIn);
        m_clientContext.ExecuteQuery();

    Hi talib2608,
    Chris is correct for this issue, when calling update using ListItem.update method, it will increase item versions, using SystemUpdate and UpdateOverwriteVersion will update the list item overwrite version.
    these two methods are not available in CSOM/REST, only server object model is available for this.
    Thanks,
    Qiao Wei
    TechNet Community Support

  • SharePoint 2013 implement simple logout button which do not redirect to default sign out page using JavaScript client object model

    I am using windows authentication in my web application.
    My requirement is to implement a sign out button which will sign out the user without having him to close the browser and application should not ask him to login again.
    I tried following two options:
     1. Redirecting the user to default signout.aspx page " /_layouts/15/SignOut.aspx "
     2. Using "Sign In as a different user" URL " /_layouts/15/closeConnection.aspx?loginasanotheruser=true "
    In first case, user is redirected to default sign out page but he can press "Go Back to Site" link to revisit the site. Another major issue is that the user has to close the browser to sign out from the application completely, which is not desirable
    in my project requirement.
    In second case, the the current user is signed out of the application but if the user has saved the password in browser, he gets signed in automatically to the application.
    I also came across the solution where we replace the default sign out page with a custom sign out page, but I am not sure whether it can be implemented using JavaScript Client Object Model of SharePoint.

    Hi 
    I'm basically looking for the exact answer for the query.
    Meanwhile you need to go through the link mentioned below in order to understand how to do it.
    Debugging and Logging Capabilities in SharePoint 2010
    Indul Hassan
    Microsoft Community Contributor
    http://www.indulhassan.com
    You Snooze.. You Lose !!

  • Client object model in SharePoint 2013

    Hi,
    I have installed .Net 2012 and want to create one client object model .But SharePoint is not installed in my system.So how i will get the SharePoint templates in the .net and how i  am able to do this.
    Please help
    Thank you

    Hi,
    Thanks for reply.
    But i am working in client machine and i have to create app using client object model and i have no access to the server.
    As per your answer, you want say i have to install SharePoint in my client system ?
    Then only i get the sharepoint templates in the .Net ?

Maybe you are looking for

  • How to generate param-prefix in web-services.xml

    Hello I am using source2wsdd to generate my WSDL and my web-services.xml. For sake of interoperability I would like to have the type param-prefix in the web-services.xml file. From my Bean class what kind of javadoc comments would help me generate th

  • How to log the messages in an internal table n display

    Hello guys, This is my first post in SDN. I am uploading some data from application server. I am doing lot of varifications, based on that I have to display the messages. So I asked not to use the write statements to display the messages but asked me

  • How do I find tools in the bar?

    I cannot see where I can find and use Tools in the bar of the homesite.

  • MySql driver not found in WEB-INF/lib

    Hello This topic is very often met on this forum but there are no suitable answers for the problem I have. I am creating a Jsf application and I have setup a connection pool using the MySql jar. I want to supply the jar with the war and I keep it in

  • Startup upgrade problem

    Hi, Trying to upgrade manually from 10204 to 11202 : cat /etc/oratab +ASM:/u01/app/11.2.0/grid:N             # line added by Agent dudwh:/u01/app/oracle/product/11.2.0/DUDWH11gR2:NStart the db in upgrade mode: SQL> startup UPGRADE ORA-01078: failure