none
Project Server CSOM function CreateProjectSite() takes too much time. How to enqueue? RRS feed

  • Question

  • Hello,

    I am using this function when a the project site does not exist to create a Project Site in SharePoint Server 2016.

    Microsoft.ProjectServer.Client.PublishedProject.CreateProjectSite()

    When more than once at same time is executed, we got some errors (not timeout) like PJCallable cannot connect to remote server. So, I guess this is a resources availability problem with Memory or CPU (The server has a lot of resources) . So, I would like to know if it is possible to enqueue or use a pattern to avoid that kind of results.

    Thank you!


    Wednesday, February 6, 2019 2:57 PM

Answers

  • Hi Jose, 

    Glad that you finally found the root cause of the issue. Since you are using a custom site template, it takes time based on, if there are any additional lists created (or) if you maintain any static data/documents in the templates  etc.. . So you need to decide the waitTime based on the template  size/customization.

    hope , it helped you to fix your issue. Please mark it as answer if my inputs helped  you to fix the issue.

    ---------

    Rajkumar

    Friday, February 15, 2019 6:22 AM

All replies

  • Hello,

    I am working on a project which creates a project site using CSOM (is not created from Project Server automatically). So, unfortunately, this function takes a long time and, I guess, consumes a lot of memory or resources from CPU (It is not possible to create more than 3 projects sites at same time with a nice server):

    Microsoft.ProjectServer.Client.PublishedProject.CreateProjectSite()

    So, I would like to know if is possible to add some function in c# to Project Server Queue.

    Otherwise, if there is some pattern or a workaround to enquee and avoid Project server goes down.

    Thank you!

    Wednesday, February 6, 2019 2:29 PM
  • Hello,

    Are you using a custom project site template? Have you tried with the default "Project Site" template?

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Sunday, February 10, 2019 9:55 PM
    Moderator
  • Hello Paul,

    We are using a custom EPT. we could not use  the default project site template.

    Is there any difference?

    Thank you

    Best regards,

    Monday, February 11, 2019 8:12 AM
  • Hi Jose,

    Are you using customized project site apart from default? If yes, please save that custom project site as a template. Then go to Custom EPT and choose the "custom site name" under the "Site Template". So that the custom EPT will use the Custom project site template instead of default site.

    Hope, it resolves your issue.

    Rajkumar Allepu.


    Monday, February 11, 2019 9:56 AM
  • Hello,

    Custom EPT is fine as is a custom site template but depending on what is in your custom site template, this might be why it's taking a while. As a test, try it with the default "Project Site" template and see if that is any quicker.

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Tuesday, February 12, 2019 8:46 AM
    Moderator
  • Hello Paul,

    It is a little bit quicker, but I should to use a Custom EPT. We are not able to execute 

    Microsoft.ProjectServer.Client.PublishedProject.CreateProjectSite()

    More than 3 times at same time.

    Is there any way or pattern to execute this kind of requests?

    Thank you!
    Wednesday, February 13, 2019 9:55 AM
  • Hello Rajkumar,

    Yes I am using that configuration, but it takes a long time to execute some times and also cannot execute more than three times at same time.

    Is there any way to achieve this?

    Thank you!

    Wednesday, February 13, 2019 9:56 AM
  • Hi Jose,

    Have tried your scenario, and happened in just seconds.. below is the piece of code I have written.

                    PublishedProject publishedProject = collection.FirstOrDefault();
                    publishedProject.CreateProjectSite("projectSite_" + projectName);
                    JobState jobState = context.WaitForQueue(context.Projects.Update(), 10);
                    if(jobState==JobState.Success)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "ALERT", "alert('Project site created..')", true);
                    }


    But here this code is using default project site template.
    Thursday, February 14, 2019 5:58 AM
  • Hello Rajkumar,

    I have noticed that you did not execute ProjectContext.ExecuteQuery() after  CreateProjectSite() function.

    So, I have removed too and, in my local pc, seems to be working kind of faster. I will let you know if it works faster in the real environment. On the other hand, I have already used the WaitForQueue method ;)

    Thank you!

    Thursday, February 14, 2019 10:10 AM
  • Hello Rajkumar,

    I need to mention that the code without ProjectContext.ExecuteQuery() works much faster.

    But it means that CreateProjectSite() does not take too much time. On the other hand, ProjectContext.ExecuteQuery() takes 4 minutes.

    If I apply this:

    JobState jobState = context.WaitForQueue(context.Projects.Update(), 10);
                    if(jobState==JobState.Success)
                    {
                     //Do something
                    }

    I got an Timeout error after 2 minutes, even if I increase the parameter time to 10 minutes,

    Thank you!

    Thursday, February 14, 2019 1:20 PM
  • Hi Jose, 

    Glad that you finally found the root cause of the issue. Since you are using a custom site template, it takes time based on, if there are any additional lists created (or) if you maintain any static data/documents in the templates  etc.. . So you need to decide the waitTime based on the template  size/customization.

    hope , it helped you to fix your issue. Please mark it as answer if my inputs helped  you to fix the issue.

    ---------

    Rajkumar

    Friday, February 15, 2019 6:22 AM