settings Content type

Welcome Forums General PowerShell Q&A settings Content type

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years, 2 months ago.

  • Author
    Posts
  • #6427

    Member
    Points: 0
    Rank: Member

    by bronyx85 at 2013-04-09 12:01:22

    Hi,

    I have approx 100+ content types whose settings are Read Only on the root site.

    I need to able to change this setting, so that they are not read only, but it needs to be done via powershell.

    Can someone help me in such a way in which i can
    a) get a list of all the content types and store them in a variable
    b) loop through all the content types in the variable and change the settings so that they are not read only?

    Many thanks

    by AlexBrassington at 2013-04-09 13:09:14

    Content types exist at many levels but primarily at the root web of a site collection. The read only property is straight on the content type.

    by bronyx85 at 2013-04-09 23:18:28

    Hi.
    Yes, they are the root level, but how do I change the read only setting via powershell for all content types in the system which are currently read only.

    by bronyx85 at 2013-04-10 06:06:25

    its ok. I have solved it.
    A for each loop which queries the site, then loops through each library solved the issue.

    thanks.

    by AlexBrassington at 2013-04-12 11:05:28

    For anyone who finds this via search:
    Add-PSSnapin Microsoft.SharePoint.Powershell -ea SilentlyContinue

    #Get site collection
    $SiteCollection = Get-SPSite "http://sharepoint/sites/cthub"

    #Groups
    $ContentTypes = $SiteCollection.RootWeb.ContentTypes | ? {$_.ReadOnly -eq $True -AND $_.Hidden = $false }
    foreach ($ContentType in $ContentTypes)
    {
    $ContentType.ReadOnly = $false
    $ContentType.Update()
    }

    That'll update all visible content types to be read/write. It would be much better to run it against a white-list of content types as even the visible one could lead to items that you shouldn't be modifying being changed.

The topic ‘settings Content type’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort