none
Bulk remove enterprise custom fields using powershell from PWA RRS feed

  • Question

  • Hi All,

    I was working on Project server 2016 and trying to build script to delete some enterprise fields using power shell & following is the approach i tried.

    {

     $projectContext = New-Object Microsoft.ProjectServer.Client.ProjectContext("PWA URL")

     //Here goes the code to retrieve required custom fields

     //Now loop through retrieved fields

     $projectContext.CustomFields.Remove(customField)

    }

    this Remove method call is always returning false and field never gets deleted.

    Help me with details if anyone faced this earlier (or) any better way to bulk delete/remove enterprise custom fields from PWA

    The current available option to delete from PWA directly doesn't let us to select everything and delete.

    Regards,

    Ashok


    Friday, October 20, 2017 10:25 AM

All replies

  • First off I apologise for not testing this myself before answering, but I would have tried using the CustomFieldCollection Remove method instead:

    $projectContext.CustomFieldCollection.Remove(customField) 

    As said, I'm not sure this helps, but why not give it a try?

    A question arises, though - why have you created so many custom fields that you need a script to remove them?

    The rule of thumb is to be fairly frugal when it comes to custom fields as an overly generous number of fields tend to slow things down quite a bit...

    /Lars Hammarberg


    //Lars Hammarberg www.oneagency.se

    Monday, October 23, 2017 8:13 PM