none
MS project server 2016 The specified server may not support APIs used in this operation RRS feed

  • Question

  • Microsoft.SharePoint.Client.ServerException: 'Cannot find stub for type with id "{154360b4-899f-4237-b0ed-3e35f014c748}". The specified server may not support APIs used in this operation.' Solution deployed from VS.

    Crash on projContext.ExecuteQuery(), how solve this problem?

            private static ProjectContext projContext;
            private static PublishedTask projTasks;

            protected void Page_Load(object sender, EventArgs e)
            {
                SPSecurity.RunWithElevatedPrivileges(delegate ()
                {
                    projContext = new ProjectContext(siteUrl);
                    projContext.Load(projContext.Projects);
                    projContext.ExecuteQuery();

                    List<string> TasksID = new List<string>();

                    foreach (PublishedProject pubProj in projContext.Projects)
                    {
                        Console.WriteLine("\n\t{0} : {1}", pubProj.Name, pubProj.CreatedDate.ToString());
                        foreach (PublishedTask item in pubProj.Tasks)
                        {
                            TasksID.Add(projTasks.Name);
                        }
                        Console.WriteLine("\nProject ID : Project name : Created date");
                    }
                });

    Friday, January 25, 2019 3:07 PM

All replies

  • Do you have code prior to this for logging into Project Server?

    Replace the number of lines in code example to focus in on which API.  For example, If you remove the commands in foreach clause, does it still occur.


    Michael Wharton, Project MVP, MBA, PMP and a Great Guy <br/> Website http://www.WhartonComputer.com <br/> Blog http://MyProjectExpert.com contains my field notes and SQL queries

    Friday, January 25, 2019 7:01 PM
    Moderator
  • Hi Alesha,

    I am running into this same issue and I found that for some reason when you run the projContext.Load and execute query twice it then works which is not the best solution.  It seems to throw this error on the first execute query then work on the second.  Have you found a work around on this issue?  I'm at a loss on how to resolve it unless its strictly an account issue.  One guess I'm thinking about is make sure the account has both admin rights in sharepoint as well as project server but thats untested at this point.  

    If you have found a work around please let me know this is a really show stopper for me.

    Thanks

    Don


    Don Landry

    Thursday, September 5, 2019 9:44 AM
  • Hi Michael,

    Do you have any ideas on this issue.  Here is what I am finding.  

    I authenticate into an on prem instance with an admin account

    projContext = new ProjectContext(pwaPath); - use the path for the pwa instance

    projContext.Credentials = new NetworkCredential(UserId, Password); - use the admin credentials that I have

    then  all I do after that is try to retrieve a list of projects(see below). The first time the execute query occurs I get the API error but if I attempt to do the query again it brings back the projects.  The only problem is it doesn't necessarily bring everything back.  For example if I do this with custom fields it will bring back the core custom field data but then for graphical indicators it will throw error index out of range.  If I do this via an online instance it works fine its only OnPrem that this is an issue.   One thought I have is to compare the SharePoint and Project Server dll versions that are stored on the server in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\ to my reference dlls to see if the versions are the same.  Note that all I am doing is direct read querying of the On Prem site so any ideas on what I'm missing.  

    You can find a sample piece of code to run in C:\Program Files (x86)\Microsoft SDKs\Project 2013\Samples\samples.exe and I am using the code from CSOM\ReadlistofProjects  

    I have a ticket in with Microsoft on this issue but if you can help me direct them to the right person (they aren't sure where the ticket should go) that could help as well.

     

     try
                {
                    projContext.Load(projContext.Projects);
                    projContext.ExecuteQuery();
                }
                catch
                {
                    projContext.Load(projContext.Projects);
                    projContext.ExecuteQuery();
                }

    Thanks

    Don


    Don Landry

    Saturday, September 7, 2019 2:28 PM