Search code examples
c#apims-projectpsi

List Published Projects From MS Project 2010 API


The Project API allows you to list projects using

ProjectDataSet data = client.ReadProjectList();
foreach (ProjectDataSet.ProjectRow projectRow in data.Project){...}

This API call is deficient due to the fact that it returns all projects from the working store and not the published store. It seems like your expected to check every project GUID against the published store which is incredibly slow.

int i = projectRow.PROJ_TYPE;
if (i == 0){
    ProjectDataSet publishedProjectDataSet = client.ReadProject(projectRow.PROJ_UID, DataStoreEnum.PublishedStore);
    if (publishedProjectDataSet == null) { continue; }
}

Does anyone know of anyway to quickly list only the published projects?


Solution

  • projectClient.ReadProjectStatus should work . E.g.

     // Get list of all projects.
     SvcProject.ProjectDataSet projectDs = projectClient.ReadProjectStatus(
     Guid.Empty, SvcProject.DataStoreEnum.PublishedStore,
     string.Empty, (int)PSLibrary.Project.ProjectType.Project);
    

    Documentation is located at here.