Select option "Show this View : in Folder of Content type : {Custom Content Type Name}" while creating view using CSOM

Hi,
I am trying to create "View" in a Document Library and need to enable following:
1. Mark as default View
2. Folders -> Show this view : in Folders of Content Type : {Custom Content Type name}
I am using following code which sets "in Folders of Content Type : " to "Folder" rather than selecting custom content type despite passing Content Type ID of custom content type.
code:
var itemContentTypes = clientContext.LoadQuery(web.AvailableContentTypes.Where(ct => ct.Name == viewContentType));
clientContext.ExecuteQuery();
var itemContentType = itemContentTypes.FirstOrDefault();
view.ContentTypeId = itemContentType.Id;
view.DefaultViewForContentType = true;
view.Update();
clientContext.ExecuteQuery();
Please highlight what seems to be missing?
Thanks
Sonal

Hi,
Before you set the content type ID for the view, you need to add the custom content type to the library firstly.
You can add the content type to library using OOTB feature “Add from existing site content types” in library settings or using Client Object Model.
Here is a code snippet for your reference:
var list = context.Web.Lists.GetByTitle(listTitle);
list.ContentTypesEnabled = true;
var contentType = context.Site.RootWeb.ContentTypes.GetById("0x0120");
list.ContentTypes.AddExistingContentType(contentType);
context.ExecuteQuery();
More information about add exist content type using Client Object Model:<o:p></o:p>
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.contenttypecollection.addexistingcontenttype%28v=office.15%29.aspx
Best regards,
ZhengyuGuo
Zhengyu Guo
TechNet Community Support

Similar Messages

  • HT201514 I keep getting this message "Unable to complete back up an error has occurred while creating back up folder" Why is this happening and is it time to purchase a new tim machine?

    I keep getting this message “Unable to complete back up an error has occurred while creating back up folder” Why is this happening and is it time to purchase a new tim machine?

    Check out the Apple Support Communities Time Machine expert Pondini's troubleshooting article on this exact topic. Hopefully, it will help.

  • HT201407 i forgot my apple id and password now my phone is not activate there message show this iphone was lost and erased sighn in with the apple id that was used to erase this iphone

    i forgot my apple id and password now my phone is not activate there message show this iphone was lost and erased sighn in with the apple id that was used to erase this iphone

    http://support.apple.com/kb/PH13695
    Click this link.. its help you
    http://www.youtube.com/watch?v=V48tYnkT4QI

  • Problem creating basic views while creating materials using idocs?

    hello,
    I am facing an issue while creating materials using idocs. The problem is that the basic view does not get created whereas other views are present. The function module used is idoc_input_matma01 and the basic idoc type is MATMAS03.
    Looking for help. Thank you

    Hi Madhu,
    Actually i recieve an idoc from PI containing data required for cretion of the material via an idoc. This idoc is then processed to create the required material.
    The material gets created with appropiate data in various tables(mara, makt) but when we view material in mm03 we cant see the basic data views.

  • Can't do online banking. Get error message. "The requested URL /Summary.cgi was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    I can't do online banking. When I try to open the page I get error "The requested URL /Summary.cgi was not found on this server.
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    Hi,
    These blog posts might help debug problem
    Oracle APEX: Got a 404 Not Found? | Inside Oracle APEX by Patrick Wolf
    daust_de :: Oracle XE / APEX: Troubleshooting the 404-not found error on XE
    Regards,
    Jari

  • Getting Error ORA-00604 While Creating View from front Ent

    Hello All,
    I am getting ORA-00604 while creating view from the front end. And some time I get Maximum cursor open, It is ok amy be I am opening cursors in while loop. While ORA-00604 is giving lots of truble to me. In help it said to contact Oracle service, I dont know how to do that. Help me.

    Please post your view definition including the complete error_message and also the relevant parts of your code with the while loop.

  • WD: Select Options shows empty ranges

    Hi there,
    Im using select options in my wd application... I defined a few fields (numeric, dats and so on).  I was expecting that the select options in wd works like the normal ones in normal abap report.
    But when I try to read the results from select options , the result range table has no sign or option value (low value ok) ... when I reach the result to a Select statement a shortdump happen with the notice there is no sign or option value in the IN parameter of the Selection statement.
    Does any one know if this is standard behavior of WD select options ?

    Hi ,
    try to understand following code .
    METHOD wddoinit .
      DATA:
           lr_componentcontroller TYPE REF TO ig_componentcontroller,
           l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
      DATA:
          lt_range_table       TYPE REF TO data,
          lt_types             TYPE string_table,
          rt_range_table       TYPE REF TO data,
          text                 TYPE string,
          typename             TYPE string.
      DATA: vbeln TYPE lips-vbeln,
            erdat TYPE lips-erdat,
            auart TYPE vbak-auart,
            trnsp TYPE vtadd01t-add_info,
            kunnr TYPE likp-kunnr.
      DATA:
        num_events TYPE i.
      DATA: uname TYPE sy-uname.
      uname = sy-uname.
      wd_context->set_attribute(  name = 'CUSTOMER'
      value = uname  ).
    *  wd_context->GET_ATTRIBUTE( Name = 'TRANSPORTER_CODE'
    *  Value = uname ).
    * create the used component
      l_ref_cmp_usage = wd_this->wd_cpuse_select_options( ).
      IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
        l_ref_cmp_usage->create_component( ).
      ENDIF.
    * get a pointer to the interface controller of the select options component
      wd_this->m_wd_select_options = wd_this->wd_cpifc_select_options( ).
    * init the select screen
      wd_this->m_handler = wd_this->m_wd_select_options->init_selection_screen( ).
      lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'VBELN_VL' ).
      wd_this->m_handler->add_selection_field(
        i_description                = 'Sales Document'
        i_id                         = 'VBELN'
        i_obligatory                 = 'X'
        it_result                    = lt_range_table
        i_value_help_structure       = 'LIPS'
        i_value_help_structure_field = 'VBELN' ).
      lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'ERDAT' ).
      wd_this->m_handler->add_selection_field( i_id = 'ERDAT'  i_obligatory = 'X' it_result = lt_range_table ).
    *lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'VTTK_ADD01' ).
    *wd_this->m_handler->add_selection_field( i_id = 'VTTK_ADD01' I_DESCRIPTION  = 'CHAHA' it_result = lt_range_table ).
    *    wd_this->m_handler->add_selection_field(
    *      i_description                = 'Transporters Code'
    *      i_id                         = 'VTTK_ADD01'
    *      it_result                    = lt_range_table
    *      i_value_help_structure       = 'VTADD01T'
    *      i_value_help_structure_field = 'ADD_INFO' ).
    *Supress Global options in Used Component
      wd_this->m_handler->set_global_options(
          i_display_btn_cancel  = ''
          i_display_btn_check   = ''
          i_display_btn_execute = ''
          i_display_btn_reset   = '' ).
      lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'VBAK-AUART' ).
      wd_this->m_handler->add_selection_field(
        i_description                = 'Sales Document Type'
        i_id                         = 'AUART'
         i_obligatory                = 'X'
        it_result                    = lt_range_table
        i_value_help_structure       = 'VBAK'
        i_value_help_structure_field = 'AUART' ).
    ENDMETHOD.
    METHOD onactionexecute .
      DATA: node_saledoc TYPE REF TO if_wd_context_node.
      DATA: node_crdate TYPE REF TO if_wd_context_node.
      DATA: node_transcode TYPE REF TO if_wd_context_node.
      DATA: node_doctype TYPE REF TO if_wd_context_node.
      DATA: node1 TYPE REF TO if_wd_context_node.
      DATA: node2 TYPE REF TO if_wd_context_node.
      DATA: rt_saledoc TYPE REF TO data.
      DATA: rt_crdate TYPE REF TO data.
      DATA: rt_transcode TYPE REF TO data.
      DATA: rt_doctype TYPE REF TO data.
      FIELD-SYMBOLS: <fs_saledoc> TYPE table,
                      <fs_crdate> TYPE table,
                      <fs_transcode> TYPE table,
                      <fs_doctype> TYPE table.
    * Retrieve the data from the select option
      rt_saledoc = wd_this->m_handler->get_range_table_of_sel_field(
      i_id = 'VBELN' ).
    * Assign it to a field symbol
      ASSIGN rt_saledoc->* TO <fs_saledoc>.
    * Retrieve the data from the select option
      rt_crdate = wd_this->m_handler->get_range_table_of_sel_field(
      i_id = 'ERDAT' ).
    * Assign it to a field symbol
      ASSIGN rt_crdate->* TO <fs_crdate>.
    * Retrieve the data from the select option
      rt_doctype = wd_this->m_handler->get_range_table_of_sel_field(
      i_id = 'AUART' ).
    * Assign it to a field symbol
      ASSIGN rt_doctype->* TO <fs_doctype>.
    * Retrieve the data from the select option
    *rt_transcode = wd_this->m_handler->get_range_table_of_sel_field(
    *i_id = 'VTTK_ADD01' ).
    ** Assign it to a field symbol
    *assign rt_transcode->* to <fs_transcode>.
      node_saledoc = wd_context->get_child_node( name = 'S_VBELN' ).
      node_saledoc->bind_table( <fs_saledoc> ).
      node_crdate = wd_context->get_child_node( name = 'S_ERDAT' ).
      node_crdate->bind_table(  <fs_crdate> ).
      node_doctype = wd_context->get_child_node( name = 'S_AUART' ).
      node_doctype->bind_table( <fs_doctype> ).
      IF <fs_doctype> IS NOT INITIAL
        AND <fs_crdate> IS NOT INITIAL
        AND <fs_saledoc> IS NOT INITIAL
        wd_comp_controller->execute_zotddelvnote_vend_tari( ).
      ENDIF.
    ENDMETHOD.
    Regards,
    Amit solanki
    Edited by: Amit Solanki on Aug 19, 2009 11:30 AM
    Edited by: Amit Solanki on Aug 19, 2009 11:32 AM

  • Getting prob while creating view in webdynpro ABAP application

    Hi Guys,
    I am facing a problem while creating a view for webdynpro ABAP application. It is giving an error as "ICF service "/sap/public/bc/WebDynpro/ViewDesigner" inactive".
    can anybody let me know how to solve this problem.
                   Thanks In Advance
    Regards
    Ravikumar

    I think check Internet explorer Tools ->Internet Options ->Connections.>Lan Connections> if the proxy or anyting checkbox is clicked coz it doesn't work with Internet on .
    Please reward if useful.

  • Bug in BC4J test query while creating view based on query

    In BC4J while creating a view from query if we test our query , BC4J modify the query with the following one :
    "SELECT * FROM ( " + ourQuery + " ) where 1=2;"
    so for the Query like "SELECT ename,ename from emp" which is a valid query it modifies it to
    "SELECT * FROM ( SELECT ename,ename from emp ) where 1=2;"
    which is an invalid Query and BC4J get a SQLException:column ambiguously defined and Test fails
    BC4J does this modification in query because it doesn't want to Fetch Data from Database and add the where clause
    to the query but in Cases like above this modification doesn't work properly.
    one way to solve the problem is by giving alias name to the columns of query.Is there any other way to do the same as my query is completely Valid and i don't want to change it at all ?

    Hi Jan,
    Actually I am getting my query at run time and based on that I am creating a view.This Query can be given by User of my application and at that time it'll be very painful for me to handle that.
    It's definately a Bug in BC4J as they should not modify the query in this way.Thanx for ur interest in my problem.

  • Error while creating view

     Hello,
    I am trying to create view which is based on multiple source tables and I am receiving following error 
    Internal error: An expression services limit has been reached. Please look for potentially complex expressions in your query, and try to simplify them.
    Can anyone know how to resolve this.
    Thanks,

    See MS Support for how to solve it:
    Error message when you run a query in SQL Server 2005: "Internal error: An expression services limit has been reached"
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Error while creating view in component - BT115H_SLSO

    Hi All,
    When I am creating view in the BSP Component workbench(T/code: BSP_WD_CMPWB), I
    am getting the error "Invalid GUI INPUT DATA :INVALID XMLBLOB DATA" shot and suggest me how to come out of this error.
    Component: BT115H_SLSO
    Regards,
    Praveen

    Hello,
    The problem could be a SAPGUI related problem... Whats the current sapgui patch level ? Does it work when you try on another wokstation with the same user ?
    Could you please use SAPGUI 720 and update your patch level to 7 ? Then check the behaviour again.
    Best regards
    Rene

  • Call procedure while creating view in hana.

    Can we call procedure while creating a attribute view like
    CREATE VIEW "PAYROLLDBTEST"."@HourTransactionView"
    "DocEntry",
    "DocNum",
    "EmpID",
    "EmpCode",
    "FullName",
    "TableName",
    "TranName",
    "U_FromDate",
    "U_ToDate",
    "NoOfDays",
    "U_FromTime",
    "U_ToTime",
    "NoOfHours",
    "OvertimeHours",
    "UnpaidDays",
    "Weekends",
    "Holidays",
    "U_Remarks",
    "U_BatchNo",
    "ProjectCode"
    ) AS SELECT
      T0."DocEntry" AS DocEntry,
        T0."DocNum" AS DocNum,
       T0."U_EmpCode" AS EmpID,
    CALL PAYROLLDBTEST.GetEmpCodeFromEmployeeID('EmpID')  ,              (getting syntax error here).
        GetEmployeeFullName("@TRANSACTION_HOURS".U_EmpCode) AS FullName,
          T0."U_TransactionType" AS TranCode,
        GetHourTableName("U_TransactionType") AS TableName,
         GetHourTransactionName("U_TransactionType") AS TranName,
        T0."U_FromDate",
        T0. "U_ToDate",
          DAYS_BETWEEN("U_FromDate", "U_ToDate") + 1 AS NoOfDays,
          T0."U_FromTime" AS U_FromTime,
           T0."U_ToTime" AS U_ToTime,
        IFNULL("U_WorkHours", 0) AS NoOfHours,
         IFNULL("U_OvertimeHours", 0) AS OvertimeHours,
        IFNULL("U_PaidDays", 0) AS PaidDays,
         IFNULL("U_UnpaidDays", 0) AS UnpaidDays,
        IFNULL("U_WeekendsCount", 0) AS Weekends,
         IFNULL("U_HolidaysCount", 0) AS Holidays,
          T0."U_Remarks",
           T0."U_BatchNo",
        T0."U_ProjectCode" AS "ProjectCode"
        FROM
        "@TRANSACTION_HOURS" T0
        INNER JOIN
        "OHEM" T1
        ON
         T1."empID" = T0."U_EmpCode";

    Hello,
    The problem could be a SAPGUI related problem... Whats the current sapgui patch level ? Does it work when you try on another wokstation with the same user ?
    Could you please use SAPGUI 720 and update your patch level to 7 ? Then check the behaviour again.
    Best regards
    Rene

  • Table aliases while creating views in KM

    Hello All,
    While executing an interface I noticed that it failed on the LKM step -
    Create View on Source
    (LKM MSQL to MSQL)
    On investigation, I found the error was because of an in invalid alias (alias created was a sql server keyword) that ODI had assigned to the source table. I extracted the code from the KM and I am hoping someone could direct me on how I could modify the KM so that the alias ODI creates is different from what its currently set to.
    TIA
    MN

    MN you dont need to modify the KM , when you click on the required Datastore , you will find the alias name , there change it accordingly or in the Datastore itself. I think that should help you .

  • Folio showing in Content Viewer, but not when published in Custom Content Viewer... please help...!

    I shared a folio to review it in the Content Viewer and everything looks ok, but when published (public / free) custom viewer (v24) doesn't show it. What could be the problem?
    Thanks, and excuse my english...

    I am guessing two things:
    1. You created the folio and uploaded to id [email protected] Then you shared with [email protected]
    What is the Title id mentioned in DPS App builder. If it's [email protected], it will not work.
    2. Do you have multiple folios with the same product id.

  • Webdynpro error while creating "view"

    Hi!
    All,
    I am trying to perform one tutorial provided on sdn website for webdynpro and title of which is "WDA Tutorial I: Getting Started with
    Web Dynpro for ABAP"
    I am using Netweaver 2004s on my desktop.
    When I try to create a view on workbech , it returns with the following error message.
    Service cannot be reached
    What has happened?
    URL http://runner:8001/sap/bc/wdvd call was terminated because the corresponding service is not available.
    Note
    The termination occurred in system KHA with error code 403 and for the reason Forbidden.
    The selected virtual host was 0 .
    What can I do?
    Please select a valid URL.
    If you do not yet have a user ID, contact your system administrator.
    ErrorCode:ICF-NF-http-c:000-u:SAPSYS-l:E-i:runner_KHA_01-v:0-s:403-r:Forbidden
    HTTP 403 - Forbidden
    Your SAP Internet Communication Framework Team
    Can anyone help me to resolve this error???
    Cheers
    Khalil.

    Awarding points is a common thing here on SDN.  It is a way to show thanks to those who contribute to your questions.  Next to each response, under the answering person's name, there should be 3 radiobuttons.  You can reward points based on the level of "helpfulness".  10 points if the answer helped to solve your problem, 6 points for a general very helpful answer, and 2 points for a helpful answer.  When you mark as "Solved my problem(10 points), this awards ten points to that person and marks the thread as being solved.  Since you have already marked this thread as "Solved on my own", that closes the thread without rewarding any points.  You can simply reverse this flag, and then select the appropriate points for the answers.  If no answers, solved your problem to your satisfaction, but you still solved the problem, you can award points(6 or 2) to the answers and mark the questions as "solved on my own".  Hope this helps.
    Regards,
    Rich Heilman

Maybe you are looking for

  • Issue while downloading the alv report output in spreadsheet format .

    Hi, I have a report output, whenever I try to download it in the spreadsheet format to my desktop, I get the following issue: Say the correct material number is 10833340001218999 or 10030000063207001 (This appears in the report output) But in the exc

  • BPM Process as Web Service

    When the BPM Process is exposed and used as a Web Service, is it possible to have the returntype other than the instanceId. Thanks!

  • FLV marks start a event in the site

    Hello! I working with my new website where I want to show a FLV movie. Next to the movie, I have a text box that will have a new text at certain times. I want some kind of marker in the film to trigger the change. I use Aftereffets to make the movie

  • Artist name shows under song name in itunes

    in my itunes library, in the artist view, i go to the artist i want to listen to, then all of albums show up, some albums, have the artist name under the song, i look at the info of the entire album(songs on that album) and the artist and album artis

  • [FLASH MX2004] LOADMOVIE

    This is a multi-part message in MIME format. ------=_NextPart_000_0008_01C6E408.F3667FD0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Amigos del foro tengo una consulta que es la siguiente: Tengo un .fla