1. Get the Identity of the Work Management Service Application
Scenario/Problem: You need to find the identity of the Work Management Service application.
Solution: Use the Get-SPServiceApplication
cmdlet.
To get a specific instance of a Work
Management Service application, you need the identity of the service
application. No cmdlet exists for getting a Work Management Service
application, so you need to use the Get-SPServiceApplication
cmdlet to display all service applications and find the Work Management Service. Listing 1 shows the command line without any parameters.
Listing 1. Displaying the List of Service Applications
Get-SPServiceApplication
2. Get a Specific Work Management Service Application Instance
Scenario/Problem: You need to obtain a metadata service application instance reference.
Solution: Use the Get-SPServiceApplication
cmdlet to assign a variable the results using the -Identity
parameter.
Providing the identity of the Work Management Service Application instance with the Get-SPServiceApplication
cmdlet retrieves a specific Work Management Service instance. Use this
to assign the results to an object for use in other cmdlets, as shown
in Listing 2.
Listing 2. Assigning a Variable to a Specific Work Management Service Application
$workMgmt = Get-SPServiceApplication
-Identity 61295eb2-c947-4bab-9333-3adee98d9125
Instead of the GUID, you can use the display name. The default display name for the Work Management Service application is Work Management Service
. Because this is a long name, when displaying the service applications, the full text is cut off.
3. Configure the Refresh Threshold
Scenario/Problem: You would like to configure the minimum time between provider refreshes within the Work Management Service application.
Solution: Use the Set-SPWorkManagementServiceApplication
cmdlet with the -MinimumTimeBetweenProviderRefreshes
parameter.
You can use the -MinimumTimeBetweenProviderRefreshes
cmdlet to configure the minimum amount of time between cache updates.
This is on a per-user basis. The service application waits until the
time specified before it processes new refresh requests.
The data type of this parameter is System.TimeSpan
; therefore, creating a new time span variable to provide is recommended (see Listing 3).
Listing 3. Configuring the Refresh Setting
$refreshTimeSpan = New-TimeSpan -Minutes 15
Set-SPWorkManagementServiceApplication
-Identity "Work Management Service"
-MinimumTimeBetweenProviderRefreshes $refreshTimeSpan
The Identity
parameter also can be a specific Work Management Service application instance using the Get-SPServiceApplication
cmdlet, as explained in the previous section.