Hi, I added some users in the Portfolio Viewers group to access the APIs to get the project data to the Power BI. They are able to access OData information without any issues. However, we have custom fields on Risks and Issues template that needs the project site access as these fields are not available in the standard reports. How can I grant access to these users to a project site by default? If that is not possible, can I create a script to add these users as part of the Members group for each project site automatically, either upon project site creation or by running as a batch script to add them to the groups programmatically? We are using Project Server 2016
This could be done, the easiest approach is running this on a schedule. If you want to run it automatically on site creation / project publish, you would need to build an event receiver application so that your custom code gets notified to execute etc. We wont be able to write the code for you here on this forum but here technically this is possible. If you search the web for adding users to SharePoint sites using CSOM you will find examples.