none
How To Update Project Site URL using CSOM (.Net) in Project Server 2016 ?? RRS feed

  • Question

  • Hi All,

    We are using Project Server 2016 , and want to update Project Site URL using CSOM (.Net).

    Please suggest possible solution.

    Earlier in PSI (2013) it was UpdateProjectWorkspaceAddress of Project.svc, but now i guess Project.svc is not availaible so cannot use the same.

    Please help with some solution, i want to update Project Site URL ,using CSOM (.Net).

    Thanks.


    Sandeep Nandey

    Friday, December 16, 2016 1:56 PM

All replies


  • Hi Sandeep,

    Yes. we can do that, but 50% client side and 50% server side. Check below code

    first part - Get the project site URL using project server client object model (Microsoft.Projectserver.client)

    Second part - Update project site URL using SharePoint server side model. Because, we don't have property called 'Name' for SharePoint client side object model for web object. So we should use server side object model only.

    Note:

    1. Project server client model won't support updating web url, hence I tried with SharePoint, because at the end project server site also one of the SharePoint site created by different template.

    try and let me know, if you found any issues.

    static

    void Main(string[] args)

    {

               

    Guid projGuid = new Guid("e77ce267-4bc1-e611-9a73-005056a3284d"); // replace with your project guid

               

    try

                {

                   

    ProjectContext projContext = new ProjectContext("xxxxx"); //replace with pwa url

                    projContext.Load(projContext.Projects);

                    projContext.ExecuteQuery();               

    PublishedProject pubProject = projContext.Projects.Where(proj => proj.Id == projGuid).FirstOrDefault();

                    projContext.ExecuteQuery();

                    projContext.Load(pubProject, p => p.ProjectSiteUrl);

                    projContext.ExecuteQuery();               

    string projSiteUrl = pubProject.ProjectSiteUrl;

                   

    using (SPSite site = new SPSite(projSiteUrl))

                    {

                       

    using (SPWeb web = site.OpenWeb())

                        {

                            web.AllowUnsafeUpdates =

                            web.Name = "test1234";

                            web.Update();

                            web.AllowUnsafeUpdates = false;

                        }

                    }    

    }

                }

               

    catch (Exception ex)

                {

                }


    vamsi

    Tuesday, December 20, 2016 5:49 PM
  • Hi vamsi,

    Thanks for the reply , but this will not solve my issue.

    Let me explain the scenario:

    1. By default Project Server creates the project site under PWA .( e.g.  /PWA/ProjectSite 

    2. But, I am having a Project Event Handler which creates the Project Site based on some custom field values [Selection Criteria] under different URL 

    eg. /PWA/SiteABC/SiteEFG/ProjectSite

    3. Now when we are doing this, we are not able to update the Project WorkSpace Address [Project Site URL] to the created site address [ /PWA/SiteABC/SiteEFG/ProjectSite] from event handler

    4. In Project Server 2013 PSI we are using UpdateProjectWorkspaceAddress method of Project.svc, which is i guess no loger available in Project Server 2016.

    So i am stuck here ,as i am not able to find any method to silimar to UpdateProjectWorkspaceAddress method of Project.svc


    Sandeep Nandey

    Wednesday, December 21, 2016 5:51 AM
  • Hi Sandeep,

    did you find a solution for this? Struggling with the same issue. Seems not to be possible.

    Thanks

    Christoph


    Christoph Muelder | Senior Consultant, MCTS, MCSE | SOLVIN information management GmbH, Germany

    Friday, December 30, 2016 2:37 PM
  • Hi Christoph,

    No, still not able to get the solution.

    As of now we are doing it manually from:

    PWA Setting > Operational Policies > Connected SharePoint Sites

    /_layouts/15/pwa/Admin/ManageWSS.aspx


    Sandeep Nandey

    Tuesday, January 10, 2017 4:14 AM
  • Have you found any solution to update the Project Site URL through code. Please help me.
    Wednesday, May 31, 2017 9:38 AM