#SharePoint item count from all lists on all sub webs in SharePoint / #ProjectOnline #PPM #PowerShell

September 28, 2017 at 11:29 am | Posted in Administration, Functionality, Add-on, Customisation, Information, Reporting, PowerShell | Leave a comment
Tags: , , , ,

This is a supporting blog post for an example PowerShell script I quickly wrote for Microsoft’s Office 365 SharePoint Online. It was created after a query was posted on the Project Online TechNet forums asking how to easily check what sub sites were being used in PWA.

The code sample can be downloaded from here: https://gallery.technet.microsoft.com/Get-item-count-from-all-026a6db2

To get the script to work, there will need to be some environment variables set and a DLL available, these are detailed below.

Update the environment details:

image

Add the SharePoint Online / PWA URL, username and password for an account that is a site collection admin on the target site collection.

To get the script to work you will need to reference the DLL as seen in the image below:

image

This can be installed from the SharePoint Online Client components / management shell. I used the dll from the SharePoint Online Management Shell in this example.

Below you can see the output from the PowerShell ISE when running against my test SharePoint / Project Online site collection:

SNAGHTML9ae65556

There are probably easier ways to view this information but I thought I would just try with a simple PowerShell script.

Advertisements

Running #ProjectOnline #PowerShell in #Azure using #AzureFunctions #PPM #Cloud #Flow #LogicApp Part2

August 1, 2017 at 4:32 pm | Posted in Add-on, Administration, Configuration, Customisation, Functionality, Information, PowerShell, Workflow | Leave a comment
Tags: , , , , , , ,

Following on from part 1 where I introduced the idea of automating certain Microsoft 365 PPM Project Online customisations using PowerShell, Microsoft Flow / Azure Logic Apps and Azure Functions, in part 2 I will set up an example automation for creating a Project Online event driven snapshot application on project published without having to set up any server or write any complied code! If you missed part 1 where this concept was introduced, see the link below:

https://pwmather.wordpress.com/2017/07/28/running-projectonline-powershell-in-azure-using-azurefunctions-ppm-cloud-flow-logicapp-part1/

Firstly I created an Azure Function app in my Azure subscription then created a new function based on the HttpTrigger – PowerShell template:

image

Give the function a name and set the Authorisation level – set the authorisation level to the correct setting for your function. Click Create. For details on Azure Functions, start here: https://docs.microsoft.com/en-us/azure/azure-functions/

You will then be presented with the function and sample code:

image

We will now create the PowerShell script to create the snapshot. This is based on a script I published a while back: https://pwmather.wordpress.com/2016/08/26/projectonline-data-capture-snapshot-capability-with-powershell-sharepoint-office365-ppm-bi/

The script has been updated to work in an Azure Function but also modified to use a parameter so that it only captures data for the published project, the PowerShell script can be seen further on in the post.

Firstly upload the SharePoint CSOM DLLs using the upload button:

image

I used the SharePoint CSOM DLLs from the SharePoint Online Management Shell:

image

Then enter the PowerShell code – screen shots below and code pasted below the images:

image

image

image

Code sample used in function:

# POST method: $req
$requestBody = Get-Content $req -Raw | ConvertFrom-Json
$projID = $requestBody.projID

# GET method: each querystring parameter is its own variable
if ($req_query_name) 
{
    $projID = $req_query_name 
}

#add SharePoint Online DLL - update the location if required
Import-Module "D:\home\site\wwwroot\ProjectSiteUserSyncHTTPTrigger\Microsoft.SharePoint.Client.dll"
Import-Module "D:\home\site\wwwroot\ProjectSiteUserSyncHTTPTrigger\Microsoft.SharePoint.Client.Runtime.dll"

#set the environment details
$PWAInstanceURL = "https://mod497254.sharepoint.com/sites/PWA2"
$username = "admin@MOD497254.onmicrosoft.com" 
$password = "password"
$securePass = ConvertTo-SecureString $password -AsPlainText -Force
#create the SharePoint list on the PWA site and add the correct columns based on the data required
$listname = "ProjectSnapShots"
$results1 = @()

#set the Odata URL with the correct project fields needed
$url = $PWAInstanceURL + "/_api/ProjectData/Projects()?`$Filter=ProjectId eq GUID'$projID'&`$Select=ProjectId,ProjectName,ProjectPercentCompleted"

#get all of the data from the OData URL
while ($url){
    [Microsoft.SharePoint.Client.SharePointOnlineCredentials]$spocreds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePass);    
    $webrequest = [System.Net.WebRequest]::Create($url)
    $webrequest.Credentials = $spocreds
    $webrequest.Accept = "application/json;odata=verbose"
    $webrequest.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f")
    $response = $webrequest.GetResponse()
    $reader = New-Object System.IO.StreamReader $response.GetResponseStream()
    $data = $reader.ReadToEnd()
    $results = ConvertFrom-Json -InputObject $data
    $results1 += $results.d.results
        if ($results.d.__next){
        $url=$results.d.__next.ToString()
    }
    else {
        $url=$null
    }
}

#add data to snapshot list
#get PWA site client context
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($PWAInstanceURL) 
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePass) 
$ctx.Credentials = $credentials 
$ctx.ExecuteQuery()  
 
#get the target list 
$List = $ctx.Web.Lists.GetByTitle($listname) 
$ctx.Load($List) 
$ctx.ExecuteQuery() 

#for each project, create the list item - update the newitem with the correct list columns and project data
foreach ($projectrow in $results1) 
{ 
   $itemcreationInfo = New-Object Microsoft.SharePoint.Client.ListItemCreationInformation 
   $newitem = $List.AddItem($itemcreationInfo) 
   $newitem["Title"] = $projectrow.ProjectName
   $newitem["ProjectId"] = $projectrow.ProjectId
   $newitem["PercentCompleted"] = $projectrow.ProjectPercentCompleted
   $newitem.Update() 
   $ctx.ExecuteQuery() 
} 

The PowerShell code would need to be updated with your environment details: (PWAInstanceUrl, username, password and listname variables). Also the OData URL will need to be updated to include the project level fields that you want to snapshot.The target SharePoint list will also need to be set up in the PWA site collection for the project fields the script uses. This is the list I set up for this example:

image

SnapshotDate is set to Todays date so we don’t need to set that in the code.

The code is simple to follow but in summary the first part will get the projID from request body – we will pass in the ProjectID for the published project from the Flow / Logic App trigger. Then the SharePoint Online CSOM DLLs are imported in. Then the specific PWA environment details are set for the variables. The OData URL is then added to the url variable. Here notice we are filtering for the ProjectID and passing in the $projID variable we get from the request body. The Select part of the query will need to be updated for your project level fields. Next the code gets the data from the OData feed using the web request and adds the data into the results array. Once we have the data, we connect to the SharePoint list, in the example it is the ProjectSnapShots as set in the $listname variable. Lastly the new item is created in the list using the data from the results array.

Now the Azure Function is ready to be used. It can be tested using the Test option in the right hand panel, update the Request body:

image

Update it for a valid project ID. Then click Run above the function code:

image

The Logs window below will help you debug any errors etc.:

image

Then check the SharePoint list in the PWA site and the new item should have been created:

image

We now know the Azure Function is working as expected, now we need to call the Azure function when a project is published. All we need from the Azure Function is the URL to use, use the </>Get function URL button:

image

Select the correct Key, in this example I used the default function key. Copy the URL as it will be needed later.

To call the Azure Function when a project is published, the choice here for a no code option would be Microsoft Flow or Azure Logic App. For this I will use Microsoft Flow but the same steps (triggers , actions etc.) would be used in the Azure Logic App. Create a new Flow and search for Project Online:

image

Then select the Project Online – When a project is published trigger.

Enter the PWA URL:

image

Then click the ellipsis and set the connection for the PWA URL or create a new connection if needed:

image

Click + New step then Add an Action and search Http:

image

Select HTTP – HTTP:

image

Complete the HTTP action:

Method is POST, the Uri is the URL for the function that we copied earlier, Headers are not required. The Body is where we pass in the project ID from the published project trigger:

image

The Flow is now completed:

SNAGHTML55ecdca7

Now click Save flow.

In PWA, Publish a project or projects and see the snapshot data created on the configured snapshot list once the Flow has run:

Flow run:

image

Data added to the list for the project I published – in this example it was the Office 2016 rollout project:

image

This just shows a simple example and the some of the possibilities for extending the Project Online capability when making use of simple PowerShell scripts and other Microsoft 365 / Azure services for cloud / serverless solutions. Look out for more examples in the future.

Running #ProjectOnline #PowerShell in #Azure using #AzureFunctions #PPM #Cloud #Flow #LogicApp Part1

July 28, 2017 at 4:50 pm | Posted in Add-on, Administration, App, Configuration, Customisation, Fixes, Functionality, Information, PowerShell, Workflow | 4 Comments
Tags: , , , , , ,

Following on from my last post where I published an example solution starter PowerShell script for adding project team users to the Project Site, here I mentioned about running the script in an Azure Function and even running this sync from a Project Online event. The blog post can be seen below if you missed that:

https://pwmather.wordpress.com/2017/07/07/projectonline-project-user-sync-to-project-sites-ppm-o365-powershell-sharepoint/

Whilst I will use that example PowerShell script from my last blog post as an example, the concept will work for any PowerShell script.

I wont cover the details in setting up the Azure Function in part 1 as there is plenty of support out there for this – for this example I created an Http Trigger – PowerShell function.

image

I then uploaded the SharePoint DLLs and copied in the PowerShell script into the editor:

image

The project site user sync script didn’t work as is as I had to make some minor changes to get this to run from the Azure Function. This included change the way the SharePoint CSOM DLLs where loaded in. In the example script I used Add-Type to load the DLLs but in the Azure Function I had to switch this out to use Import-Module:

image

The next change I had to make was to comment out all of the feedback to the console, so all of the write-hosts. I also had to remove the functions within the script so that is was one block. After these changes I could execute the PowerShell script to add the project team members from my example project into the associated project site from the Azure Function. As this was an HTTP Trigger Azure Function, you can get the URL to the function and access that URL to execute the function.

This opens up lots of possibilities to easily execute this Azure Function from other applications that can make the HTTP call. For example you build easily execute this script once the project has been published either using a remote event receiver (RER) or a Microsoft Flow / Azure Logic App. The example script would need to be made generic and pass in a variable into the Azure Function for it to be a workable solution.

In part 2 of this blog post we will look at make a full event driven solution that is fired on project publish then executing the Azure Function and passing in a variable.

#ProjectOnline project user sync to project sites #PPM #O365 #PowerShell #SharePoint

July 7, 2017 at 4:13 pm | Posted in Add-on, Administration, App, Customisation, Functionality, Information, PowerShell, Workarounds | 1 Comment
Tags: , , , ,

This is a supporting blog post for an example solution starter PowerShell script I wrote for Microsoft’s Office 365 PPM tool Project Online. With the great improvement from Microsoft to now support up to 30,000 Projects and Project Sites in one Project Online Project Web App site collection, there are some limitations such as not being able to sync the users to project sites outside of the PWA site collection. For details on this change see the post here:

https://pwmather.wordpress.com/2017/06/14/projectonline-project-site-settings-location-sharepoint-ppm-o365-msproject/

This solution starter script just demonstrates one method to sync the project team members into the associated Project Site-  the concept would also be useful when using the SharePoint permission mode in PWA. The example script is fixed to one example project / project site and only adds the team members to the members SharePoint group on that site. It doesn’t loop through all projects  or remove users from the project sites etc. This could all easily be done but is beyond the scope of the code sample / solution starter.

The code sample / solution starter can be downloaded from here: https://gallery.technet.microsoft.com/Online-User-Sync-to-7a75ef77

To get the script to work, there will need to be some environment variables set and a DLL available, these are detailed below.

To get the script to work you will need to reference the DLL as seen in the image below:

image

This can be installed from the SharePoint Online Client components / management shell. I used the dll from the SharePoint Online Management Shell in this example.

You will then need to update the environment detail placeholders as seen below:

image

Add the Full PWA URL, username and password for an account that is a full admin on the PWA site collection. Select an example project to test with on a non-production PWA project / project site. Use a project that is not syncing the users to the project site automatically – for example a project site outside of the PWA site collection. Copy the Project GUID – it will be similar to this: 4b75dfb8-4051-e711-80c9-00155da85037 and update the script with the project GUID. An easy way to get the Project GUID is from the PWA PDP URL when accessing the project. For the same project, copy the full project site URL and update the script then find the name of the correct SharePoint group to add the users to. For example it could be the members group. The groups can be found from the project site > Settings cog > Site Settings > Site Permissions.

Once these variable placeholders are set, save the script. Run the script using PowerShell and you will see the users added to the specified group on the project site. Fully test this on a non-production PWA instance first. The code should really be updated to production standard code before using on a production PWA instance and handle removing users, adding users to different permissions groups based on role and dynamically getting the projects and project site urls etc.

Below you can see the output from the PowerShell ISE when running against my example project  / project site on my test PWA instance:

image

Looking at the project site you can see the users here:

image

A production version of the PowerShell script could be set to run each day / night etc. as required. The code could also easily be run using an Azure Function and executed from a URL – you could then build is an event driven type user sync – more on that in my next blog post.

The script is provided "As is" with no warranties etc. – this is just a free solution starter so is use at your own risk.

Update #ProjectOnline Resource custom field values using #PowerShell with data from #AzureAD user attributes #PPM #Offce365 #ProjectServer #CSOM

November 7, 2016 at 9:40 pm | Posted in Add-on, Administration, Configuration, Customisation, Functionality, Information, PowerShell, Reporting | Leave a comment
Tags: , , , , , , , ,

This blog post will demonstrate a simple example of how Microsoft’s PPM tool, Project Online, can include / sync metadata from Azure AD user attributes to resource custom fields in Project Online. This example script will update the resource custom field “Job Title” on my test tenant with the data from the Azure AD user “Title” attribute.

This script example can be downloaded here: https://gallery.technet.microsoft.com/Update-Online-Resource-83137b7f

The script does require some additional modules / DLLs to work. Firstly you will need the Azure AD module installed, this can be downloaded here: http://connect.microsoft.com/site1164/Downloads/DownloadDetails.aspx?DownloadID=59185. You will also need the SharePoint Online and Project Online CSOM DLLs. The DLL’s used are from the NuGet package here: https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM/16.1.5521.1200. There are later version available, check here: https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM. Download those as required. These modules can be seen here on line 3,5 and 14 in the example script, the location will need to be updated to reference the correct location for your SP / PS Online CSOM DLLs.

The user setting up the script will need to update the correct location to the DLLs required, the AD username, AD password, CSV file location, PWA instance URL, username, password and the custom field internal name. The PWA account specified will need edit access to all of the resources in PWA and the AD account will need access to read all the users in Azure AD. Ensure the variables have been updated correctly, placeholder values seen below:

image_thumb.png

In this example all users in the Azure AD will be exported, clearly if you have a large organisation it would be efficient the filter for only those users that exist in Project Online. The code matches users and resources based on the AD display name and PWA resource name when updating the resources in PWA.

To get the correct custom field internal ID I use the REST API, <PWA Site URL> + /_api/ProjectServer/CustomFields. Find the resource level custom field and copy the InternalName as seen below:

image_thumb.png

Once the PowerShell script has been updated, save it and it can then be tested on a test / non-production environment. Once executed in PowerShell, each resource found in the CSV file will be outputted as seen in the example below. In this example there are many AD users in the CSV export that do not exist in the PWA instance.

image_thumb.png

Checking in the Resource Center after the script has run you can see for the resources that exist in the CSV file created, the Job Title has been updated with the values found in Azure AD / the export CSV file:

image_thumb.png

The CSV file generated can be seen here:

image_thumb.png

This PowerShell script could be run on a schedule from a server on-prem or even in Azure / webjob. The script would just need access to save / access a CSV file and the DLLs / modules required. Fully test this script on a test / non-production PWA instance before running on a Production PWA instance.

The script is provided “As is” with no warranties etc.

Update #ProjectOnline Project custom field values using #PowerShell with data from a CSV file #PPM #ProjectServer #CSOM

November 6, 2016 at 4:44 pm | Posted in Add-on, Administration, Configuration, Customisation, Functionality, Information, PowerShell | 1 Comment
Tags: , , , , , , , ,

This blog post will demonstrate a simple example of how Microsoft’s PPM tool, Project Online, can include data from an external system. This is a very simple example using a demo CSV mock up of data that could be from an external system. The CSV part could easily be replaced by a SQL query or a REST API query to the source system etc.

Example CSV data used can be seen below:

image

As you can see, my imagination for example project names has not improved! The code uses the Project Name as the key between the two data sets – the CSV file and PWA so the names will need to match.

This script example can be downloaded here: https://gallery.technet.microsoft.com/Update-Online-Custom-Field-12f034f4

The user setting up the script will need to update the correct location to the DLLs required, the PWA instance URL, username, password, the custom field internal name and the location of the CSV file. The account specified will need edit access to all of the projects in PWA. Ensure the variables have been updated correctly, placeholder values seen below:

image

image

The DLL’s used are from the NuGet package here: https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM/16.1.5521.1200. There are later version available, check here: https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM. Download those as required.

The get the correct custom field internal ID I use the REST API, <PWA Site URL> + /_api/ProjectServer/CustomFields. Find the project level custom field and copy the InternalName as seen below:

image

Once the PowerShell script has been updated, save it and it can then be tested on a test / non-production environment. Once executed in PowerShell, each project found in the CSV file will be outputted as seen in the example below. In this example two projects exist in the CSV data but not in my example Project Online PWA instance (remember for this example, the names need to match in the CSV file and PWA):

image

Checking in the Project Center after the script has run you can see for the projects that exist in the CSV file, the project budget includes the values found in the CSV file:

image

This PowerShell script could be run on a schedule from a server on-prem or even in Azure. The script would just need access to the data to import (CSV file etc.) and the DLLs. Fully test this script on a test / non-production PWA instance before running on a Production PWA instance.

The script is provided "As is" with no warranties etc.

#ProjectOnline data capture / snapshot capability with #PowerShell #SharePoint #Office365 #PPM #BI

August 26, 2016 at 11:03 am | Posted in Add-on, Administration, Configuration, Customisation, Functionality, Information, PowerShell, Reporting | 4 Comments
Tags: , , , , , ,

This blog post will show an option to capture Microsoft’s PPM Project Online data into a SharePoint list on a schedule to enable time driven data capture for snapshot / trend reporting capability. This example makes use of a PowerShell script I created to get the data and write this to a SharePoint list. The PowerShell script will use the Project Reporting OData API to get all of the specified project data in the PWA Site Collection then create a list item on the specified SharePoint list. The user setting up the script will need to update the source PWA instance URL, username, password and list name. The account specified will need access to the OData API in PWA and contribute access to the target SharePoint list. The SharePoint list will also need to be created beforehand with the required columns. The OData query will need to be updated to include the correct project level fields required and the part of the script that creates the list items will need to be updated too. This is covered below.

This script example can be downloaded here: https://gallery.technet.microsoft.com/Online-Snapshot-example-0437b680

To get the script to work you will need to reference the DLL as seen in the image below:

image

This can be installed from the SharePoint Online Client components / management shell. I used the dll from the SharePoint Online Management Shell in this example.

Please note, this has only been tested in PowerShell 3.0 and might not work in other versions. If you have any issues try this in PowerShell 3.0.

Firstly decide what project level fields you want to capture, this will determine the list column requirements. Then create the SharePoint list in the PWA site collection with the required columns, for this example I created a list called ProjectSnapShots with the columns below:

image

The SnapshotDate column was set to have today as the default value so that when the items are created the date is set automatically.

Update the Project OData query to include the correct fields that you want to capture, in this simple example I have included the following:

image

$url = $PWAInstanceURL + "/_api/ProjectData/Projects()?`$Filter=ProjectType ne 7&`$Select=ProjectId,ProjectName,ProjectPercentCompleted,ProjectHealth,ROI,RiskRating&`$orderby=ProjectName"

As you can see I have a list column for each project level field. The next part of the script that needs to be updated is the item creation:

image

This is where you map the project level fields to the correct SharePoint list columns based on the data you are capturing.

Also ensure the variables have been updated correctly, placeholder values seen below:

image

Save and run the PowerShell script (fully test on a non-production PWA site collection before Production) to ensure the data is captured correctly in the target SharePoint list. You could then set this up to run as a scheduled task on a local server or a scheduled WebJob in Azure to capture the data weekly or monthly etc. For details on a scheduled WebJob see: https://azure.microsoft.com/en-gb/documentation/articles/web-sites-create-web-jobs/

Once the script is run you will see the data in the SharePoint list, below I have run this 3 times:

image

You could then create a snapshot / trend report as required from the list data and even join to the live Project OData API if you capture the Project ID as I have in the example script / list.

A simple time driven data capture to enable snapshot / trending reports for Project Online. This script could easily be modified to capture the data into a SQL database, either on-prem or in Azure SQL if required. Also if this was to be run in production the script should be updated for error handling with try / catch blocks etc.

The script is provided "As is" with no warranties etc.

Access #ProjectOnline #Project sites using #PowerShell and #SharePoint CSOM #Office365

July 8, 2016 at 8:26 pm | Posted in Add-on, Administration, Configuration, Customisation, Functionality, Information, PowerShell | Leave a comment
Tags: , , , , ,

This PowerShell script will use the Project Reporting OData API to get a list of all the Project Sites in the PWA Site Collection linked to a project. It will then access each of those project sites to enable you to easily update / review the site if needed. This example just lists all of the list titles for each site but can be used as a starting script for modifying a particular list or adding a new list on all project sites etc. This could be used to help rollout changes to existing Project Sites, the code here will help you get connected and access each Project Site object using CSOM. You could even use this example to get the project site URLs then use the approach I blogged about the other month with the PnP PowerShell to month the sites. The example is for Project Online but could easily be updated for Project Server 2013 / 2016.

The user running the script will need to update the source PWA instance URL, username and password. The account will need access to the OData API in PWA and access to all of the project sites.

This script example can be downloaded here: https://gallery.technet.microsoft.com/Access-all-Online-Projects-568c7c59

To get the script to work you will need to reference the DLL as seen in the image below:

image

This can be installed from the SharePoint Online Client components / management shell. I used the dll from the SharePoint Online Management Shell in this example.

Please note, this has only been tested in PowerShell 3.0 and might not work in other versions. If you have any issues try this in PowerShell 3.0.

The good thing about using the OData API to return the list of Project Site URLs is that if you have certain sites for each Enterprise Project Type you could easily filter the OData query to only return the project site URLs for the correct Enterprise Project Type.

Once the variables have been updated correctly, placeholder values seen below:

image

Save and run the PowerShell script (fully test on a non-production PWA site collection before Production), firstly this example will give you a count of project sites:

image

Then for each of those sites it will list all of the SharePoint lists on each site:

image

As mentioned, this just lists all of the lists so probably isn’t that useful unless you wanted to check each Project Site had the correct lists. The script could be modified to update those project sites or lists fairly easily depending on what the changes were. All I would say is that if you are looking to update / make changes to the project sites, fully test your modified script on a non-production PWA instance first as you could cause a lot of damage if you weren’t careful!

The script is provided "As is" with no warranties etc.

Extract #ProjectOnline or #ProjectServer 2013 / 2016 Timesheet data #PowerShell #Office365

May 17, 2016 at 4:32 pm | Posted in Add-on, Administration, Configuration, Customisation, Functionality, Information, PowerShell, Reporting | Leave a comment
Tags: , , , , ,

This PowerShell script will use the Project Reporting OData API to extract the timesheet data between the given start and end dates. The user running the script specifies the source PWA instance URL, Username and password. They then enter the start and finish dates in yyyy-mm-dd format and run. The data will then be displayed in the console and output to a CSV file.

This script example can be downloaded here: https://gallery.technet.microsoft.com/Extract-Online-or-Server-c1cba361

To get the script to work you will need to reference the DLL as seen in the image below:

image

This can be installed from the SharePoint Online Client components / management shell. I used the dll from the SharePoint Online Management Shell in this example.

Please note, this has only been tested in PowerShell 3.0 and might not work in other versions. If you have any issues try this in PowerShell 3.0.

Firstly it will prompt for the source PWA URL:

image

Then the username and password:

image

Then the start and finish dates in yyyy-mm-dd format:

image

The script will output the data to the console:

image

It will also create a CSV file in the same folder that the PowerShell script is run from:

image

The CSV file:

image

This was only run against a test PWA instance in Project Online and only my account had timesheet data for the given period, it will return all of the timesheet data for all resources for the given start and finish dates.

This example requires the user to enter the environment details when running but it could easily be updated to hard code these then the PowerShell script could be scheduled to run weekly or monthly etc. The start and finish dates could be made dynamic too.

Whilst this only reads data, as always, this script is provided as is with no warranties etc. use at your own risk and test on a test environment before using on a production environment.

#Office365: quickly see which #SharePoint sites are #ProjectOnline sites #PowerShell

April 5, 2016 at 11:44 am | Posted in Administration, Configuration, Customisation, Functionality, Information, PowerShell | Leave a comment
Tags: , , ,

In Office 365 from the SharePoint admin center it is not possible to quickly see which site collections are PWA site collections. The only way currently to check in the UI is the select a site collection then click the Project Web App button on the Site Collections ribbon and see if the Remove and Settings options are enabled:

image

If you select a normal SharePoint site collection these two options are disabled:

image

As you can imagine, if you have many site collections this could be quite a slow process. There is a simple and quick answer to this, PowerShell. Using the SharePoint Online Management Shell you can access the properties of the site collections, details on the SharePoint Online Management Shell can be seen below:

https://support.office.com/en-us/article/Introduction-to-the-SharePoint-Online-Management-Shell-c16941c3-19b4-4710-8056-34c034493429

I have used the PowerShell ISE to create and run the script, to use the ISE you will need to firstly install the SharePoint Online Management Shell on your machine then import the module using the command below:

Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking

Once loaded, a simple PowerShell script can easily identify the PWA site collections:

image

There is a –Filter parameter for the Get-SPOSite command but it doesn’t allow you to filter on the Template property so I created a simple foreach loop and did the filter there.

Or if you want to see all of the site collections and the templates used to create the sites see the script below:

image

In both examples just update the site collection admin site URL and the global administrator username for the Connect-SPOService command.

**** There is a caveat to this approach (thanks to Brian Smith for letting me know), if you have a normal SharePoint site then enable PWA on the site after it is created these sites will not show as a PWA site in this script. In that scenario the PWA site is a sub site and the Get-SPOSite only gets the root site collections. I guess you could look at using CSOM / REST to get all sites. ****

If would be good to get this information visible in the view from the SharePoint Admin Center, someone has already suggested this on the Office 365 uservoice, see the link below if you want to vote:

https://office365.uservoice.com/forums/273493-office-365-admin/suggestions/9374838-enable-split-view-in-sharepoint-admin-center-to-di

Next Page »

Blog at WordPress.com.
Entries and comments feeds.