-
Notifications
You must be signed in to change notification settings - Fork 0
/
New-HUSPCRSTaskItem.ps1
43 lines (38 loc) · 1.3 KB
/
New-HUSPCRSTaskItem.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<#
.Synopsis
Adds a task to the CRS Task List
.DESCRIPTION
Adds a task to the CRS Service Requests lists, assigned to me and in the Unishare Support category
.Parameter url
The site where the task list lives
.Parameter list
The name of the task list
.OUTPUTS
A new task is added to the list
.EXAMPLE
New-HUSPCRSTaskItem -url https://unishare.hud.ac.uk/cls/teams/it/cis/crs -list "CRS Service Requests" -taskname "Create an overegineered project initiation script"
Adds a task called "Create an overegineered project initiation script"
.LINK
https://unishare.hud.ac.uk/cls/teams/it/cis/crs/CRS%20Service%20Requests
#>
function New-HUSPCRSTaskItem {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)]
[string]$url,
[Parameter(Mandatory=$True,Position=2)]
[string]$list,
[Parameter(Mandatory=$True,Position=3)]
[string]$taskname
)
$SPWeb = Get-SPWeb $url
$SPList = $SPWeb.Lists[$list]
$SPTaskAssignedTo = "AD\cmsxlb"
$SPTaskProject = "Unishare Development"
$SPTask = $SPList.AddItem()
$SPTask["Title"] = $taskname
$SPTask["Project"] = $SPTaskProject
$SPTask["AssignedTo"] = $SPWeb.EnsureUser($SPTaskAssignedTo)
$SPTask.Update()
$SPWeb.Dispose()
}