none
Update (custom) field with PowerShell RRS feed

  • Question

  • Hi folks,

    after your perfect help this morning, I need you again. With slightly the same topic.

    Now, I can get all my SharePoint list entries (with all fields and values) and Im able to import it into my project server.

    But, I can only import the title. So I have to update the Project project with another stuff like set turnover value or set a simple description.

    With PowerShell.

    Has anyone an idea?

    I tried it with DataSet and so, but I didnt find any documentation or tutorials.

    Thank you soo much!

     

    -Tobias

    Thursday, January 19, 2012 1:01 PM

Answers

All replies

  • Hi there,

    You can use Windows PowerShell cmdlets to create and configure a Microsoft Project Server Service application, create and configure a Microsoft Project Web App (PWA) instance, and create and configure Project Server permissions.
    You may need to use the PSI to update/create the custom fields.
    For more Info on PSI:
    http://msdn.microsoft.com/en-us/library/ee767707.aspx
    More sample code:
    http://msdn.microsoft.com/en-us/library/gg204248.aspx

    here are excellent articles from Brian for the same:
    http://blogs.msdn.com/b/brismith/archive/2007/12/06/setting-custom-field-values-using-the-psi.aspx
    http://blogs.msdn.com/b/brismith/archive/2010/10/05/project-server-updating-and-deleting-custom-fields-using-the-psi.aspx
    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82
    Thursday, January 19, 2012 1:11 PM
  • Good Morning Amit,

    thanks for your help - I wa soff for the weekend.

    Ok, But there is no "plain PowerShell"-Solution. So I will try to transform this C# into PowerShell and I that it will work!

    Thank you so much.

     

    - Tobias

    Monday, January 23, 2012 6:36 AM
  • Hi,

    sorry, but I dont get it. I know that PowerShell is only a wrapper for .net and c# but I have no idea how I can write a simple Script which updates my ProjectCustomFields.

    I bing'ed and google'ed it. I got gray hairs :(.

    This couldn't be sooo hard to update a simple ECF using a PowerShell script.

     

    - Tobias

    Wednesday, January 25, 2012 12:45 PM
  • Hi Tobias,

    You can create a simple console app where you can write few lines of code (as per Brian's article), & verify. Yeah, It requires a C#,.NET experience :(

    Please let us know if you need any help from us.
    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82
    Wednesday, January 25, 2012 12:49 PM
  • Hi everbody,

    I solved it! Yay! I used the PowerShell functions ReadProject(), newProjectCustomRow and queueUpdateProject()

    Thanks to everbody!

     

    - Tobias

    • Marked as answer by Tobias Scholze Thursday, January 26, 2012 2:18 PM
    Thursday, January 26, 2012 2:18 PM
  • Can you please post sample code using the PowerShell functions?

    Thanks

    - Felix

    Monday, February 13, 2012 8:52 PM
  • Hi,

    I hope it will help you to understand my last post. :)

    Variable

    1. $NewProjGuid = return value of CreateProjectFromTemplate = a project Guid
    2. $ecfGuidValue = Guid of your enterprise custom field
    3. $sessionGuid = a normal Guid value

    Set values

    1. $project = $svcPSProxy.ReadProject($NewProjGuid, 0) // or another way to get a ProjectDataSet
    2. $myNewCustomRow = $project.ProjectCustomFields.NewProjectCustomFieldsRow() 
    3. $myNewCustomRow .PROJ_UID = $NewProjGuid
    4. $myNewCustomRow .CUSTOM_FIELD_UID = [System.Guid]::NewGuid()
    5. $myNewCustomRow .MD_PROP_UID = $ecfGuidValue
    6. $myNewCustomRow .TEXT_VALUE = "My Dummy Value"
    7. $project.ProjectCustomFields.AddProjectCustomFieldsRow($myNewCustomRow)

    Update project

    1. $jobGuid = [System.Guid]::NewGuid()
    2. $svcPSProxy.CheckOutProject($NewProjGuid, $sessionGuid, "Update...") // Checkout
    3. $jobGuid = [System.Guid]::NewGuid()
    4. $svcPSProxy.QueueUpdateProject("$jobGuid", "$sessionGuid", $project, $FALSE); // Update
    5. $jobGuid = [System.Guid]::NewGuid()
    6. $svcPSProxy.QueueCheckInProject($jobGuid, $NewProjGUID, $TRUE, $sessionGuid, "CheckIn Update...") // Checkin

    Finish :)

    -Tobi

    Tuesday, February 14, 2012 12:58 PM
  • Tobias,

    I really like this approach. I'm wondering if you have streamlined this any further? Below is an update that I am working on but I don't think it' s correct ... take a look and tell me what you think?

    The goal here is to have the Script Collect all projects in Project Center, iterate through each one and update the custom Enterprise Field in each.

    <# TBD #>

    Didier


    D. Didier



    • Edited by D. Didier Tuesday, March 24, 2015 2:56 PM
    Monday, March 23, 2015 8:24 PM
  • Hi D.,

    wow, this thread is still in productive use? Nice!

    Due to the fact, that this was a script back in my university days, I did not update the script since that.

    But maybe we can update it together to provide a nice tutorial for other users.

    Feel free to contact me (tobias.scholze@live.de). I don't know if I could help, but let's try.

    Regards,

    - Tobi


    Best Regards. When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer. This helps us build a healthy and positive community.

    Tuesday, March 31, 2015 3:55 PM