Deleting sharepoint list content type Fields

Hi
Please tell me the code for deleting all the fields inside content type fields..This is my code i used,but its not deleting the fields.
 SPSite spsite = new SPSite("http://ghfjhhk18:8001");
            SPWeb web = spsite.OpenWeb();
            web.AllowUnsafeUpdates = true;
            SPList list = web.Lists["Test"];
            SPContentTypeCollection cts = list.ContentTypes;
            SPContentType ct = cts["Item"];
           // ct.FieldLinks.Delete("Expires");
            //ct.Update();
            SPFieldCollection contentTypeFieldCollection = ct.Fields;
            foreach (SPField spField in contentTypeFieldCollection)
                if (ct.Fields.ContainsField(spField.Title))
                    //SPFieldLink fieldLink = new SPFieldLink(spField);
                    ct.FieldLinks.Delete(spField.Title);
                //myContentType = null;
            ct.Update();
            web.AllowUnsafeUpdates = false;
        }but this code is not deleting the fields..
pls help me as soon as possible.
One friend told me to do for loop in reverse..but how can i accomplish that

Hi,
Please refer the below code snippet which may help you to fix your issue. If not please refer the below links also
http://ptsharepoint2010.blogspot.in/2011/12/programmatically-remove-fields-from.html
http://www.c-sharpcorner.com/uploadfile/54db21/delete-field-content-type-in-sharepoint-2010-programmaticall/
using (SPWeb web = site.OpenWeb())
SPList spList = web.Lists["<ListName>"];
SPContentTypeCollection spCTS = spList.ContentTypes;
SPContentType spCT = spCTS["YourContentType"];
spCT.FieldLinks.Delete("YourField");
spCT.Update();
If its not helping you, please let us know
Sekar - Our life is short, so help others to grow
Whenever you see a reply and if you think is helpful, click "Vote As Helpful"! And whenever
you see a reply being an answer to the question of the thread, click "Mark As Answer

Similar Messages

  • Customising a SharePoint list content type form - "Manage multiple list items with this form"

    I have designed a form for a content type on an existing SharePoint list.  When I ran the initial wizard, I selected
    Manage multiple list items with this form which is great, exactly what I want.
    But, there are some columns in this content type that I do not want repeating and have them moved them outside of the Repeating Section but I am getting the below error.  I can't seem to find a way to create a new non-repeating group though.  Any
    advice on how to do this?

    *Bump*

  • Missing Columns from List Content Type

    Hi,
    I'm having some strange problems with one of my site collections, I have site content types with a few columns in it and I'm using them in 3 different libraries.
    However recently something happened and it seems the list content types in one of the libraries have stopped using some of the columns set out in the site content type (according to library settings). The columns still show as part of the list (and the metadata
    is still in there), when I've tried adding them back to the list content types, I do not see them in the list columns group, only in their original column group. If I try to add them to the list from their original group I get the errors similar to the following:
    11.14.2014 13:16:52.85 w3wp.exe (0x1B84)
    0x0770 SharePoint Foundation
    General 8e2s
    Medium Unknown SPRequest error occurred. More information: 0x8007054f
    fd09cc9c-cf7b-1059-3bcb-0e44d3bf3743
    11.14.2014 13:16:52.85 w3wp.exe (0x1B84)
    0x0770 SharePoint Foundation
    General aix9j
    High SPRequest.AddField: UserPrincipalName=, AppPrincipalName= ,bstrUrl=http://servername/sitecollection ,bstrListName={7F184ACA-48C3-4728-AF42-A12CB55941B4} ,bstrSchemaXml=<Field Type="Lookup" DisplayName="DocumentOwner"
    Required="FALSE" EnforceUniqueValues="FALSE" List="{57d71ec0-a996-4977-abf7-4cd4e0cc105c}" WebId="53a31862-077a-4031-8aad-7f2a43e33a46" ShowField="Title" UnlimitedLengthInDocumentLibrary="FALSE" Group="_QMS"
    ID="{ca4bc17d-bb96-4aee-bb96-e645c939a013}" ,grfAdd=18
    fd09cc9c-cf7b-1059-3bcb-0e44d3bf3743
    11.14.2014 13:16:52.85 w3wp.exe (0x1B84)
    0x0770 SharePoint Foundation
    General ai1wu
    Medium System.Runtime.InteropServices.COMException: An internal error occurred. (Exception from HRESULT: 0x8007054F), StackTrace:    at Microsoft.SharePoint.SPFieldCollection.AddFieldAsXmlInternal(String
    schemaXml, Boolean addToDefaultView, SPAddFieldOptions op, Boolean isMigration, Boolean fResetCTCol)     at Microsoft.SharePoint.ApplicationPages.AddFieldToContentTypePage.AddFieldToList(SPField fldSrc)     at Microsoft.SharePoint.ApplicationPages.AddFieldToContentTypePage.UpdateList()
        at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean
    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
        at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)     at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)     at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext
    context, AsyncCallback cb)     at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer,
    IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr
    pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr
    rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
    fd09cc9c-cf7b-1059-3bcb-0e44d3bf3743
    11.14.2014 13:16:52.85 w3wp.exe (0x1B84)
    0x0770 SharePoint Foundation
    General 8nca
    Medium Application error when access /_layouts/15/fldpick.aspx, Error=An internal error occurred. (Exception from HRESULT: 0x8007054F)   at Microsoft.SharePoint.Library.SPRequestInternalClass.AddField(String
    bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd)     at Microsoft.SharePoint.Library.SPRequest.AddField(String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd)
    fd09cc9c-cf7b-1059-3bcb-0e44d3bf3743
    11.14.2014 13:16:52.85 w3wp.exe (0x1B84)
    0x0770 SharePoint Foundation
    Runtime tkau
    Unexpected System.Runtime.InteropServices.COMException: An internal error occurred. (Exception from HRESULT: 0x8007054F)    at Microsoft.SharePoint.Library.SPRequestInternalClass.AddField(String bstrUrl,
    String bstrListName, String bstrSchemaXml, Int32 grfAdd)     at Microsoft.SharePoint.Library.SPRequest.AddField(String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd)
    fd09cc9c-cf7b-1059-3bcb-0e44d3bf3743
    11.14.2014 13:16:52.85 w3wp.exe (0x1B84)
    0x0770 SharePoint Foundation
    General ajlz0
    High Getting Error Message for Exception System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> Microsoft.SharePoint.SPException: An internal error
    occurred. (Exception from HRESULT: 0x8007054F) ---> System.Runtime.InteropServices.COMException: An internal error occurred. (Exception from HRESULT: 0x8007054F)     at Microsoft.SharePoint.Library.SPRequestInternalClass.AddField(String bstrUrl,
    String bstrListName, String bstrSchemaXml, Int32 grfAdd)     at Microsoft.SharePoint.Library.SPRequest.AddField(String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd)     --- End of inner exception stack trace ---  
      at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)     at Microsoft.SharePoint.Library.SPRequest.AddField(String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd)     at Microsoft.SharePoint.SPFieldCollection.AddFieldAsXmlInternal(String
    schemaXml, Boolean addToDefaultView, SPAddFieldOptions op, Boolean isMigration, Boolean fResetCTCol)     at Microsoft.SharePoint.ApplicationPages.AddFieldToContentTypePage.AddFieldToList(SPField fldSrc)     at Microsoft.SharePoint.ApplicationPages.AddFieldToContentTypePage.UpdateList()
        at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.HandleError(Exception
    e)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
        at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()    
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    fd09cc9c-cf7b-1059-3bcb-0e44d3bf3743
    I've tried to make changes to the parent site content type, however those changes to not push down to the library in question. The missing columns have varied types (single line of text, lookup, managed metadata and so forth). All of these content types &
    site columns were created through the user interface of SharePoint.
    Can anyone help me with any ideas what has happened and/or how to fix this problem?

    Hi Hans,
    As I understand, you have custom content type in 3 libraries, while the issue occurs to the columns in this content type.
    I wonder if the issue occurs to other two libraries as well?
    From your description, "I've tried to make changes to the parent site content type, however those changes to not push down to the library in question", do you mean that changes in content type are not reflected to the list which is added to this
    content type. If that is the case, I'd suggest you recreate content type.
    If the site content type works well in other two libraries, please create a new library and add this content type. If it works well, then move the list content to this new list.
    Regards,
    Rebecca Tu
    TechNet Community Support

  • Multiple "Workflow Task (SharePoint 2013)" content type found

    Users on one specific sub-site reported that they are unable to add site columns to content type. When user clicks "add existing site column" user get error message - upon looking up on ULS, it indicate there were duplicate column "System.ArgumentException:
    No two choices should have the same ID". I came across similar issue on different site before and resolved it by deleting duplicate column, plus that site column was not used on any list or associated with any content type but this time duplicate
    column is "Task outcome" column which is associated with "Workflow Task(SharePoint2013)" content type. So looking up these two specific site column and content type I noticed there are 8 occurrence of each at affected site
    level (see below on image).
    Similarly there are 8 "Task Outcome" columns under Site Columns. So I refreshed staging env with prod copy and tried to delete "Workflow Task(SharePoint 2013" content type and got error message as shown below. Under Site features, I noticed
    "SharePoint 2013 Task List" feature was enabled, hoping this will do the trick I disabled it as we still use SharePoint 2010 workflows, but to no avail.
    Sorry, something went wrong
    The content type "Workflow Task (SharePoint 2013)" is part of an application feature.
    Not sure how it got started and something will try to find out but any advise on how to fix this issue?
    Thanks,
    MK Sin

    Hi Sin,
    According to your description, my understanding is that the users got an error when clicking “add existing site column”.
    For deleting the duplicate “Task outcome”column, you need to go to the “Workflow Task(SharePoint 2013)” content type, click the “Task outcome” column, and remove it from the content type.
    Then go to site columns, find the duplicate columns, and delete them and make sure only one “Task outcome” column exists.
    After the above, re-add the “Task outcome” into the “Workflow Task(SharePoint 2013)” content type.
    Best Regards,
    Wendy
    Wendy Li
    TechNet Community Support

  • Search for documents using External Data on list content type

    hi,
    say we have clients in an external database, we create the external content type for use in sharepoint 2013
    we create two content types, Quote and Order for use in a library
    we create a document library that uses the above content types
    we then add a column for the external data ( in this case Client Name- but also include ID) , we have the option to copy to content type selected. so now library shows 'Client' and 'Client:ID'
    I believe that column gets added to  list content types based on the 2 document content types.
    so we have list items , which have a document , a content type and a piece of data from the external LOB system.
    now that is fine, works great, however, how do you configure the content search web part to return documents based on the piece of external data - ie client:ID ? or Client Name ?
    I can map the client:ID to one of the Int00 managed properties and crawl etc - but do not see a way to use that to return documents
    any help would be appreciated :)
    thanks
    MrP

    Create a scopr with that in managed properies and then u can get results from  external sources

  • Deploying a Reusable Workflow to a List Content Type using PowerShell

    We have a situation where deployment of a reusable workflow for a site content type cannot be completed through the web interface due to the number of libraries where the content type is in use (time-out on deploy and update).
    It was hoped that this could be accomplished with PowerShell but the method of deploying to a list content type appears to be different than it is to a list (all content types).
    The below snippet works fine for a list / all content types:
    function AddWorkflowToLibraries ($SiteCollection, $ctName, $WfName, $WfAssociationName)
    $site = Get-SPSite $SiteCollection
    [Guid]$wfTemplateId = New-Object Guid
    #Step through each web in site collection
    $site | Get-SPWeb -limit all | ForEach-Object {
    $web = $_
    $_.Lists | ForEach-Object{
    if($_.AllowContentTypes -eq $true)
    if($_.ContentTypes.Item("$ctName") -ne $null)
    write-host "Enabling workflow on" $_.Title "in" $_.ParentWebUrl
    $ct = $_.ContentTypes[$ctName]
    $culture = New-Object System.Globalization.CultureInfo("en-US")
    $template = $site.RootWeb.WorkflowTemplates.GetTemplateByName($WfName, $culture)
    if($template -ne $null)
    $tasklist = "Tasks"
    $historylist = "Workflow History"
    if(!$web.Lists[$historylist])
    $web.Lists.Add($historylist, "A system library used to store workflow history information that is created in this site. It is created by the Publishing feature.",
    "WorkflowHistory", "00BFEA71-4EA5-48D4-A4AD-305CF7030140", 140, "100")
    if (!$web.Features["00BFEA71-4EA5-48D4-A4AD-305CF7030140"]) {
    Enable-SPFeature -Identity WorkflowHistoryList -Url $web.Url
    $wfHistory = $web.Lists[$historylist]
    $wfHistory.Hidden = $true
    $wfHistory.Update()
    if(!$web.Lists[$tasklist])
    $web.Lists.Add($tasklist, "This system library was created by the Publishing feature to store workflow tasks that are created in this site.", "WorkflowTasks", "00BFEA71-A83E-497E-9BA0-7A5C597D0107", 107, "100")
    $association = [Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListAssociation($template, $wfName, $web.Lists[$tasklist], $web.Lists[$historylist])
    $association.AllowManual = $true
    $_.AddWorkflowAssociation($association)
    $_.Update()
    else
    Write-Error "Workflow Template not found"
    AddWorkflowToLibraries <Site Name> <Content Type Name> <Workflow Template Name> <Association Name>
    However changing the association as follows causes the script to still execute without a problem but the workflow doesn't appear for the content and the associations collection is empty:
    function AddWorkflowToLibraries ($SiteCollection, $ctName, $WfName, $WfAssociationName)
    $site = Get-SPSite $SiteCollection
    [Guid]$wfTemplateId = New-Object Guid
    #Step through each web in site collection
    $site | Get-SPWeb -limit all | ForEach-Object {
    $web = $_
    $_.Lists | ForEach-Object{
    if($_.AllowContentTypes -eq $true)
    if($_.ContentTypes.Item("$ctName") -ne $null)
    write-host "Enabling workflow on" $_.Title "in" $_.ParentWebUrl
    $ct = $_.ContentTypes[$ctName]
    $culture = New-Object System.Globalization.CultureInfo("en-US")
    $template = $site.RootWeb.WorkflowTemplates.GetTemplateByName($WfName, $culture)
    if($template -ne $null)
    $tasklist = "Tasks"
    $historylist = "Workflow History"
    if(!$web.Lists[$historylist])
    $web.Lists.Add($historylist, "A system library used to store workflow history information that is created in this site. It is created by the Publishing feature.",
    "WorkflowHistory", "00BFEA71-4EA5-48D4-A4AD-305CF7030140", 140, "100")
    if (!$web.Features["00BFEA71-4EA5-48D4-A4AD-305CF7030140"]) {
    Enable-SPFeature -Identity WorkflowHistoryList -Url $web.Url
    $wfHistory = $web.Lists[$historylist]
    $wfHistory.Hidden = $true
    $wfHistory.Update()
    if(!$web.Lists[$tasklist])
    $web.Lists.Add($tasklist, "This system library was created by the Publishing feature to store workflow tasks that are created in this site.", "WorkflowTasks", "00BFEA71-A83E-497E-9BA0-7A5C597D0107", 107, "100")
    $association = [Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListContentTypeAssociation($template, $wfName, $web.Lists[$tasklist], $web.Lists[$historylist])
    $association.AllowManual = $true
    $_.ContentTypes[$ctname].AddWorkflowAssociation($association)
    $_.ContentTypes[$ctname].Update()
    else
    Write-Error "Workflow Template not found"
    AddWorkflowToLibraries <Site Name> <Content Type Name> <Workflow Template Name> <Association Name>
    The only change is:
    $association = [Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListContentTypeAssociation($template, $wfName, $web.Lists[$tasklist], $web.Lists[$historylist])
    $association.AllowManual = $true
    $_.ContentTypes[$ctname].AddWorkflowAssociation($association)
    $_.ContentTypes[$ctname].Update()
    But unlike the list version, the association doesn't appear to be saved and no error is generated.
    Is anyone aware of what may cause this or have an example in C# that may explain something my script is missing?

    Hi Garry,
    After you associate the workflow to the content type, you should update the update the content type using
    $ct.UpdateWorkflowAssociationsOnChildren($true,$true,$true,$false)
     method.
    Here is the completed script:
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
    $site=Get-SPSite "http://serverName"
    $web=$site.OpenWeb()
    $list=$web.Lists["ListC"]
    $taskList=$web.Lists["Tasks"]
    $historyList=$web.Lists["Workflow History"]
    $ct=$list.ContentTypes["Link"]
    $culture=New-Object System.Globalization.CultureInfo("en-US")
    $wfTemplate=$web.WorkflowTemplates.GetTemplateByName("Three-State",$culture)
    $associationWF=[Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListContentTypeAssociation($wfTemplate, "myThreeStateWF",$taskList,$historyList)
    $ct.WorkflowAssociations.Add($associationWF)
    $ct.UpdateWorkflowAssociationsOnChildren($true,$true,$true,$false)
    Here is a demo about how to update it using C#
    http://www.thorntontechnical.com/tech/sharepoint/sharepoint-2010-associate-workflow-to-content-type-in-a-feature
    Wayne Fan
    TechNet Community Support

  • List content type columns don't show new names after resource files were changed

    Hello,
    we ran into a problem, that we're not able to figure out at the moment.
    We have a site collection with site columns and site content types defined and created with
    features ant their XML files. All display names are retrieved from resource files. We do have
    several subsites, that have predefined lists also created from features and their corresponding
    XML files. They use inherited versions of these site content types as list content types with
    their columns inherited from the site columns.
    We had some changes within the resource files and never ran into a problem up to now.
    We changed the display names of some of these columns within the resource files. After
    these changes the site columns, site content types and list columns show the changes
    as planned. Unfortunately the columns of the list content types do not display the changes.
    They still show the old name. If you try to alter the old names manually the new name is
    shown within the form, but you're not able to save it and the list content type columns
    still have their old name afterwards.
    We checked our definition files and they seemed to be well.
    Any ideas?
    Regards,
    Markus
    List columns as defined within new the resource file:
    List content type columns, that do not show the changes from the new resource file:

    Hi,
    According to your post, my understanding is that you want to modify the site column name in the list.
    I try to reproduce the issue, however, everything works well.
    You can modify the DisplayName in the Element.xml file.
    Then after you redeploy the project, the site column name will be changed in the list setting page.
    In addition, please check whether you create the list correctly.
    For more information, you can refer to
    Walkthrough: Create a Site Column, Content Type, and List for SharePoint
    Thanks,
    Linda Li                
    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]
    Linda Li
    TechNet Community Support

  • Content Type field

    Is it possible to remove the hyphen between the Type and the Description in the Content Type field?
    Or maybe someone can recommend a good way to utilize it in it's current state. In most cases we currently have something like 'Flowcharts' without a description and it would be nice to be able to remove the hyphen.
    Thanks

    Hi,
    there is a very easy way to do this, without any component:
    Open the ConfigurationManager Applet and select the Views Tab.
    In the Views Tab search for the View docTypes and click Edit
    In the Edit-Dialog Replace the Default Display Expression with
    <$dDocType$> <$if dDescription$>-<$endif$> <$dDescription$>
    The hyphen will only be displayed if there is a Description.
    Greets Thorsten

  • List field vs. Content Type Field - Powershell

    Hello,
    We have a bunch of document libraries where we have a List Column that contains information.  We have recently added a content type to the libraries and would like to copy the information from the List Column to a field in the content type.
    How do I use powershell to refer to these fields?
    If I have the Document Library (List) as a variable $list then I assume that I refer to the field as $list.$column.  But how do I do the same for the document?   How do I iterate through each document in the library to accomplish the same thing
    with a for loop?
    Something like:
    $list = $web.GetList("My List Name")
    foreach ($document in $list)
    $document.Fields["Document Field"] = $list.Fields["List Field"]
    $document.update()
    Any help would be greatly appreciated,
    Matt

    your code should be similar to
    $web=Get-SPWeb http://your_site_url_here
    $list=$web.Lists["List_Name_here"]
    foreach($item in $list.Items)
    #your logic here
    Hope that helps|Amr Fouad|MCTS,MCPD sharePoint 2010

  • Application Error while activating the feature - for creating list content type, list definition and list instance

    Dear all,
    I am getting application error while enabling the feature. if any body can point out the issue - that will be helpful.
    content type
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Field ID="{4C1B0A21-FCE0-4CFE-8742-A250672AFE4F}" Type="Note" Name="CourseDesc" DisplayName="Course Description" Required="TRUE" Group="Training Site Columns"/>
    <!-- Parent ContentType: Item (0x01) -->
    <ContentType ID="0x0100d57ecc53fde34177b096abd0ec90a8f9"
    Name="TrainingCourses"
    Group="Training Content Types"
    Description="Defines a Course"
    Inherits="TRUE"
    Version="0">
    <FieldRefs>
    <FieldRef ID="{4C1B0A21-FCE0-4CFE-8742-A250672AFE4F}" Name="CourseDesc" DisplayName="Course Description" Required="TRUE"/>
    </FieldRefs>
    </ContentType>
    </Elements>
    List definition
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <!-- Do not change the value of the Name attribute below. If it does not match the folder name of the List Definition project item, an error will occur when the project is run. -->
    <ListTemplate
    Name="TrainingCourses"
    Type="10100"
    BaseType="0"
    OnQuickLaunch="TRUE"
    SecurityBits="11"
    Sequence="410"
    DisplayName="TrainingCourses"
    Description="Training Courses List Definition"
    Image="/_layouts/images/itgen.png"/>
    </Elements>
    List instance
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <ListInstance Title="TrainingCourses"
    OnQuickLaunch="TRUE"
    TemplateType="10100"
    Url="Lists/TrainingCourses"
    Description="Training Course List Instance">
    </ListInstance>
    </Elements>
    schema
    <?xml version="1.0" encoding="utf-8"?>
    <List xmlns:ows="Microsoft SharePoint" Title="TrainingCourses" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/TrainingCourses-LD_TrainingCourses" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/">
    <MetaData>
    <ContentTypes>
    <ContentType ID="0x0100d57ecc53fde34177b096abd0ec90a8f9" Name="TrainingCourses" Group="Training Content Types" Description="Defines a Course" Inherits="TRUE" Version="0">
    <FieldRefs>
    <FieldRef ID="{4C1B0A21-FCE0-4CFE-8742-A250672AFE4F}" Name="CourseDesc" DisplayName="Course Description" Required="TRUE" />
    </FieldRefs>
    </ContentType>
    </ContentTypes>
    <Fields>
    <Field ID="{4c1b0a21-fce0-4cfe-8742-a250672afe4f}" Type="Note" Name="CourseDesc" DisplayName="Course Description" Required="TRUE" Group="Training Site Columns" />
    </Fields>
    <Views>
    <View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE">
    <Toolbar Type="Standard" />
    <XslLink Default="TRUE">main.xsl</XslLink>
    <RowLimit Paged="TRUE">30</RowLimit>
    <ViewFields>
    <FieldRef Name="LinkTitleNoMenu">
    </FieldRef>
    <FieldRef Name="CourseDesc">
    </FieldRef>
    </ViewFields>
    <Query>
    <OrderBy>
    <FieldRef Name="Modified" Ascending="FALSE">
    </FieldRef>
    </OrderBy>
    </Query>
    <ParameterBindings>
    <ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,addnewitem)" />
    <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
    <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_ONET_HOME)" />
    </ParameterBindings>
    </View>
    <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx">
    <Toolbar Type="Standard" />
    <XslLink Default="TRUE">main.xsl</XslLink>
    <RowLimit Paged="TRUE">30</RowLimit>
    <ViewFields>
    <FieldRef Name="Attachments">
    </FieldRef>
    <FieldRef Name="LinkTitle">
    </FieldRef>
    <FieldRef Name="CourseDesc">
    </FieldRef>
    </ViewFields>
    <Query>
    <OrderBy>
    <FieldRef Name="ID">
    </FieldRef>
    </OrderBy>
    </Query>
    <ParameterBindings>
    <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
    <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
    </ParameterBindings>
    </View>
    </Views>
    <Forms>
    <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
    <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
    <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
    </Forms>
    </MetaData>
    </List>
    I am applying the feature to SPWeb level.
    cheers
    Sathya

    redeployed a new solution; since I was getting this error. I would have done typo errors etc.
    https://naveengopisetty.wordpress.com/2011/09/10/error-occurred-in-deployment-step-activate-features-invalid-file-name-the-file-name-you-specified-could-not-be-used-it-may-be-the-name-of-an-existing-file-or-directory-or-you-may-not-have-pe/
    Cheers
    Sathya

  • Error while adding content type fields in the EditForm.aspx for an customlist item.

    This is office 365. I have content type which is attached to custom list.
    Added new site column "CustomerAction" which was added to Content type, now when I added this field in the EDITForm.aspx using the SharePoint designer, this form is called when the custom list item is being edited.
    But when I added this extra field to EDITFORM.aspx it is giving error,. the standard correlationid error.
    Can anyone suggest, what could be problem !
    Thanks
    Labhesh
    Labhesh Shrimali

    Hi Labhesh,
    When we add the site column to the content type, there is an option to update the all
    content types which inheriting from this type.
    If we set this to Yes, then the site column will be added to the list where the content type or its child content type has been used and this column will be added to the EDITFORM.aspx too.
    So we don’t need to re-add this site column to EDITFORM.aspx.
    Thanks,
    Victoria
    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]
    Victoria Xia
    TechNet Community Support

  • SharePoint 2010 Content Type Hub

    Hi,
    I have a Content Type Hub in the SharePoint Server and it is being subscribed to one of the Web application and it’s site collections.
    If I make any changes in existing column of the Content Type in Content Type Hub and subscribe to the required site collection, the changes are not being propagated to libraries columns which are part the attached Content Type from the Conte Type Hub.
    But the Content Types are being subscribed and changes are available at Site column of the Subscribed Sites but not in the existing Library level.
    If I add the New column in CT hub and the new column appears in the existing Library of the subscribed sites.
    Please assist me how can I propagate the Content Type changes from CT Hub to the existing Library of the subscribed site?
    Regards,
    Vidya Lokesh

    It's a known issue.
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/b865e6a0-39d8-4aae-9df6-f07ff9d1d96c/content-type-changes-are-not-reflected-in-subscribing-document-libraries?forum=sharepointgeneralprevious
    MS chose to avoid pushing down to lists and libraries, presumably to avoid people trashing their systems by making silly changes and pushing them down to thousands of lists and libraries.
    The only surefire way is to delete the CT from the list/library and re-add it. You could script something up to do that I guess but I don't know of any examples of it floating about.
    PS. You're in the wrong forum, this relates to 2010 not 2013, although in this case that's not a major issue.

  • SharePoint 2007 - Content Type Usage

    My question relates to Content Type Usage.  I am helping to develop a customer facing SharePoint site template for my company.  The main purpose of the site is to track the ERP Software Implementation process from start to finish.
    I created a new task list which includes all the stages and activities within the project schedule of the implementation.  I then created a calendar View of this task list so that customers can view it in calendar form. 
    The issue that I am running into is that the Task List Item Content Type doesn't include the All Day Event column and so the items on the calendar view of the task list are not displaying properly (they end the day before vs the day of).  I found that
    I need to add the Event Content Type in order to utilize the All Day Event column.  I added the Event Content Type and now have found that's it's an either/or situation.  I can either create a New Event or a New Task.
    Long question short, is there a way that I can "merge" content types so that the Task content type includes the All Day Event column?

    Columns form part of content types, which you know.  What isn't clear is that there is a _hidden group of columns that don't appear in the SharePoint GUI.  The All Day Event is one of them.  If you were to download
    SharePoint Manager 2007 you could find the property and change it's group.  Here's a screenshot of what you'd need to change
    You'd navigate something like Farm --> Services --> Web Applications --> <Your Web App> --> <Site Collection> --> Fields.
    I normally move items from the _Hidden group to the Custom Columns grouping. This will then make it available for addition within the Content Type that you've made.
    Hope that helps.
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • Assigning External content type field column value using Client Object Model

    I have a problem assinging External column value to ListItem object with client object model-based application I'm developing. To be precise, I am able to retrieve data related to external content type by reading external list created from this content type
    but I don't know how to properly use it to assign value to this field. By doing some research on my own I concluded that BDC ID column from external list is the way to go since it uniquely defines selected row from external list but that doesn't
    tell me much since I don't know what to do with it. Currently I ended up with partial solution - to assign plain string value of picker column but that makes this value visible only in "View Properties" option on Sharepoint and not in "Edit Properties"
    which pritty much makes sence since it isn't properly related to rest of the data in specific row. Does someone have a better solution for this?
    Igor S.

    I think I understand your problem.
    In my example I have an external data column "Beneficiary Name", using a Beneficiary external content type (accessing a table of beneficiaries in a SQL table).
    I want to set the "Beneficiary Name" property using the client object model. I know the name of the beneficiary but not the ID value.
    It is a fairly simple solution. You just need to identify the name of the property SharePoint assigns to the ID field, in my case it is called "Beneficiary_ID". Then set the two properties as follows:
    thisItem["Beneficiary_Name"] = "Charitable Trust";
    thisItem["Beneficiary_ID"] = -1;
    thisItem.Update();
    Setting the ID property to -1 causes the server to do an automatic lookup for the ID from the value assigned to the item.

  • Programmatically Hiding a Content Type Field

    Here is my scenario,
    I have 2 content types (CT1 and CT2). CT2 is created programmatically using PowerShell by the lines of code given below,
    $CT1= $spWeb.ContentTypes["My Content Type 1"]
    $CT2 = $spWeb.ContentTypes["My Content Type 2"]
    if($CT2 -eq $null)
    $CT2 =New-Object Microsoft.SharePoint.SPContentType -ArgumentList @($CT1, $spWeb.ContentTypes, "My Content Type 2");
    $CT2.Group = "My Group";
    $CT2.Description = "Some Description for CT2.";
    $spWeb.ContentTypes.Add($CT2);
    I want to hide some of the columns that I inherited from CT1 in CT2. When I use the below code for hiding columns, I get 'Exception setting "Hidden": "Cannot
    change Hidden attribute for this field"'
    <pre lang="x-powershell">$field = $CT2.Fields["MyField"] #MyField - I want to hide this field
    $field.Hidden = $true;
    $field.Update()
    After I looked deeper into the problem, I found that, CanToggleHidden property for the field is set to 'False'. Hence, I decided to change the flag using reflection by using the lines below,
    $field = $CT2.Fields["MyField"] #MyField - I want to hide this field
    $bindingFlags = [Reflection.BindingFlags] "NonPublic,Instance"
    [System.Type] $type = $field.GetType();
    [Reflection.MethodInfo] $mdInfo = $type.GetMethod("SetFieldBoolValue",$bindingFlags);
    $object = [System.Object] @("CanToggleHidden",$true);
    $mdInfo.Invoke($field,$object);
    $field.Hidden = $true;
    $field.Update()
    This time, I did not get error at $field.Hidden but at $field.Update() method call, I get 'Exception calling "Update" with "0" argument(s): "This functionality
    is unavailable for fields not associated with a list."'
    Suprisingly from UI (Site Settings -> Site Content Types), I can browse to 'CT2' content type and hide columns that I don't want!!!!
    My questions is, Is there a way to hide unwanted columns programmatically?
    SSK

    You should reference the field you want to hide not from the Fields collection, but from the FieldLinks one.
    Try to change powershell string:
    $field = $CT2.Fields["MyField"]
    to this one:
    $field = $CT2.FieldLinks["MyField"]
    After it, the script should work without exceptions.

Maybe you are looking for

  • Importing from DVD-A

    Can you import into iTunes from a DVD-A disc? Thanks.

  • Controlling position of + and – when adding text size controls

    Dear gurus, I am trying to sort my text size controls (+ and –) and have managed to get them to resize but I can't get them to sit together. At the moment, visually it says Resize text then there is a big gap and there's the minus (–) then the plus (

  • Comprehensive list of apps

    I have an ipad and i really prefer free apps to paid one.(apps which are completely free) .Can anyone suggest some website which lists apps which are completely free ?Mainly games.

  • Installation OID & OEM

    After an ostensibly 'clean' install of 8.1.6.0.0 Enterprise Management Infrastructure; Custom option; all features, typical Net8 & Default DB settings I have problems. From the services panel I check the box that allows the service to talk to the des

  • Are new 5.1 upgrades for 4 & 4s only???

    I have just replaced my old 3gs with a new 3gs that is running 5.0.  I'm being told that the newer os systems are designed for the 4 & the 4s and that upgrading the older phones tends to slow them up and cause problems. My old 3gs was on 4.1 and was