Skip to content

Commit c2fa416

Browse files
Module Graph.Mail
1 parent 9ba4758 commit c2fa416

36 files changed

+2540
-1
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Mail
3+
4+
<#
5+
.SYNOPSIS
6+
Relevance classification of the user's messages based on explicit designations which override inferred relevance or importance
7+
8+
.DESCRIPTION
9+
10+
.NOTES
11+
This PowerShell script was developed and optimized for ScriptRunner. The use of the scripts requires ScriptRunner.
12+
The customer or user is authorized to copy the script from the repository and use them in ScriptRunner.
13+
The terms of use for ScriptRunner do not apply to this script. In particular, ScriptRunner Software GmbH assumes no liability for the function,
14+
the use and the consequences of the use of this freely available script.
15+
PowerShell is a product of Microsoft Corporation. ScriptRunner is a product of ScriptRunner Software GmbH.
16+
© ScriptRunner Software GmbH
17+
18+
.COMPONENT
19+
Requires Modules Microsoft.Graph.Mail
20+
21+
.LINK
22+
https://github.com/scriptrunner/ActionPacks/tree/master/MS%20Graph/Mail
23+
24+
.Parameter UserId
25+
[sr-en] User identifier
26+
[sr-de] Benutzer ID
27+
#>
28+
29+
param(
30+
[Parameter(Mandatory = $true)]
31+
[string]$UserId
32+
)
33+
34+
Import-Module Microsoft.Graph.Mail
35+
36+
try{
37+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'
38+
'UserId' = $UserId
39+
}
40+
$result = Get-MgUserInferenceClassification @cmdArgs | Select-Object *
41+
42+
if($SRXEnv) {
43+
$SRXEnv.ResultMessage = $result
44+
}
45+
else{
46+
Write-Output $result
47+
}
48+
}
49+
catch{
50+
throw
51+
}
52+
finally{
53+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Mail
3+
4+
<#
5+
.SYNOPSIS
6+
Returns a set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other
7+
8+
.DESCRIPTION
9+
10+
.NOTES
11+
This PowerShell script was developed and optimized for ScriptRunner. The use of the scripts requires ScriptRunner.
12+
The customer or user is authorized to copy the script from the repository and use them in ScriptRunner.
13+
The terms of use for ScriptRunner do not apply to this script. In particular, ScriptRunner Software GmbH assumes no liability for the function,
14+
the use and the consequences of the use of this freely available script.
15+
PowerShell is a product of Microsoft Corporation. ScriptRunner is a product of ScriptRunner Software GmbH.
16+
© ScriptRunner Software GmbH
17+
18+
.COMPONENT
19+
Requires Modules Microsoft.Graph.Mail
20+
21+
.LINK
22+
https://github.com/scriptrunner/ActionPacks/tree/master/MS%20Graph/Mail
23+
24+
.Parameter UserId
25+
[sr-en] User identifier
26+
[sr-de] Benutzer ID
27+
#>
28+
29+
param(
30+
[Parameter(Mandatory = $true)]
31+
[string]$UserId
32+
)
33+
34+
Import-Module Microsoft.Graph.Mail
35+
36+
try{
37+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'
38+
'UserId' = $UserId
39+
}
40+
$result = Get-MgUserInferenceClassificationOverride @cmdArgs | Select-Object *
41+
42+
if($SRXEnv) {
43+
$SRXEnv.ResultMessage = $result
44+
}
45+
else{
46+
Write-Output $result
47+
}
48+
}
49+
catch{
50+
throw
51+
}
52+
finally{
53+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Mail
3+
4+
<#
5+
.SYNOPSIS
6+
Returns user's mail folders
7+
8+
.DESCRIPTION
9+
10+
.NOTES
11+
This PowerShell script was developed and optimized for ScriptRunner. The use of the scripts requires ScriptRunner.
12+
The customer or user is authorized to copy the script from the repository and use them in ScriptRunner.
13+
The terms of use for ScriptRunner do not apply to this script. In particular, ScriptRunner Software GmbH assumes no liability for the function,
14+
the use and the consequences of the use of this freely available script.
15+
PowerShell is a product of Microsoft Corporation. ScriptRunner is a product of ScriptRunner Software GmbH.
16+
© ScriptRunner Software GmbH
17+
18+
.COMPONENT
19+
Requires Modules Microsoft.Graph.Mail
20+
21+
.LINK
22+
https://github.com/scriptrunner/ActionPacks/tree/master/MS%20Graph/Mail
23+
24+
.Parameter UserId
25+
[sr-en] User identifier
26+
[sr-de] Benutzer ID
27+
28+
.Parameter MailFolderId
29+
[sr-en] Mail folder identifier
30+
[sr-de] Mailordner ID
31+
32+
.Parameter Properties
33+
[sr-en] List of properties to expand. Use * for all properties
34+
[sr-de] Liste der zu anzuzeigenden Eigenschaften. Verwenden Sie * für alle Eigenschaften
35+
#>
36+
37+
param(
38+
[Parameter(Mandatory = $true)]
39+
[string]$UserId,
40+
[string]$MailFolderId,
41+
[ValidateSet('ChildFolderCount','ChildFolders','DisplayName','Id','IsHidden','Messages','ParentFolderId','TotalItemCount','UnreadItemCount')]
42+
[string[]]$Properties = @('DisplayName','Id','ChildFolderCount','TotalItemCount','UnreadItemCount')
43+
)
44+
45+
Import-Module Microsoft.Graph.Mail
46+
47+
try{
48+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'
49+
'UserId' = $UserId
50+
}
51+
if($PSBoundParameters.ContainsKey('MailFolderId') -eq $true){
52+
$cmdArgs.Add('MailFolderId',$MailFolderId)
53+
}
54+
$result = Get-MgUserMailFolder @cmdArgs | Sort-Object DisplayName | Select-Object $Properties
55+
56+
if (Get-Command 'ConvertTo-ResultHtml' -ErrorAction Ignore) {
57+
ConvertTo-ResultHtml -Result $result
58+
}
59+
if($SRXEnv) {
60+
$SRXEnv.ResultMessage = $result
61+
}
62+
else{
63+
Write-Output $result
64+
}
65+
}
66+
catch{
67+
throw
68+
}
69+
finally{
70+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Mail
3+
4+
<#
5+
.SYNOPSIS
6+
Returns a collection of child folders in the mail folder
7+
8+
.DESCRIPTION
9+
10+
.NOTES
11+
This PowerShell script was developed and optimized for ScriptRunner. The use of the scripts requires ScriptRunner.
12+
The customer or user is authorized to copy the script from the repository and use them in ScriptRunner.
13+
The terms of use for ScriptRunner do not apply to this script. In particular, ScriptRunner Software GmbH assumes no liability for the function,
14+
the use and the consequences of the use of this freely available script.
15+
PowerShell is a product of Microsoft Corporation. ScriptRunner is a product of ScriptRunner Software GmbH.
16+
© ScriptRunner Software GmbH
17+
18+
.COMPONENT
19+
Requires Modules Microsoft.Graph.Mail
20+
21+
.LINK
22+
https://github.com/scriptrunner/ActionPacks/tree/master/MS%20Graph/Mail
23+
24+
.Parameter UserId
25+
[sr-en] User identifier
26+
[sr-de] Benutzer ID
27+
28+
.Parameter MailFolderId
29+
[sr-en] Mail folder identifier
30+
[sr-de] Mailordner ID
31+
32+
.Parameter ChildFolderId
33+
[sr-en] Mail folder child folder identifier
34+
[sr-de] Mailordner-Unterordner ID
35+
36+
.Parameter Properties
37+
[sr-en] List of properties to expand. Use * for all properties
38+
[sr-de] Liste der zu anzuzeigenden Eigenschaften. Verwenden Sie * für alle Eigenschaften
39+
#>
40+
41+
param(
42+
[Parameter(Mandatory = $true)]
43+
[string]$UserId,
44+
[Parameter(Mandatory = $true)]
45+
[string]$MailFolderId,
46+
[string]$ChildFolderId,
47+
[ValidateSet('ChildFolderCount','ChildFolders','DisplayName','Id','IsHidden','Messages','ParentFolderId','TotalItemCount','UnreadItemCount')]
48+
[string[]]$Properties = @('DisplayName','Id','IsHidden','ChildFolderCount','TotalItemCount','UnreadItemCount')
49+
)
50+
51+
Import-Module Microsoft.Graph.Mail
52+
53+
try{
54+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'
55+
'UserId' = $UserId
56+
'MailFolderId' = $MailFolderId
57+
}
58+
if($PSBoundParameters.ContainsKey('ChildFolderId') -eq $true){
59+
$cmdArgs.Add('MailFolderId1',$ChildFolderId)
60+
}
61+
else{
62+
$cmdArgs.Add('All',$null)
63+
}
64+
$result = Get-MgUserMailFolderChildFolder @cmdArgs | Sort-Object DisplayName | Select-Object $Properties
65+
66+
if (Get-Command 'ConvertTo-ResultHtml' -ErrorAction Ignore) {
67+
ConvertTo-ResultHtml -Result $result
68+
}
69+
if($SRXEnv) {
70+
$SRXEnv.ResultMessage = $result
71+
}
72+
else{
73+
Write-Output $result
74+
}
75+
}
76+
catch{
77+
throw
78+
}
79+
finally{
80+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Mail
3+
4+
<#
5+
.SYNOPSIS
6+
Returns collection of messages in the mail folder child folder
7+
8+
.DESCRIPTION
9+
10+
.NOTES
11+
This PowerShell script was developed and optimized for ScriptRunner. The use of the scripts requires ScriptRunner.
12+
The customer or user is authorized to copy the script from the repository and use them in ScriptRunner.
13+
The terms of use for ScriptRunner do not apply to this script. In particular, ScriptRunner Software GmbH assumes no liability for the function,
14+
the use and the consequences of the use of this freely available script.
15+
PowerShell is a product of Microsoft Corporation. ScriptRunner is a product of ScriptRunner Software GmbH.
16+
© ScriptRunner Software GmbH
17+
18+
.COMPONENT
19+
Requires Modules Microsoft.Graph.Mail
20+
21+
.LINK
22+
https://github.com/scriptrunner/ActionPacks/tree/master/MS%20Graph/Mail
23+
24+
.Parameter UserId
25+
[sr-en] User identifier
26+
[sr-de] Benutzer ID
27+
28+
.Parameter MailFolderId
29+
[sr-en] Id of the mail folder
30+
[sr-de] Ordner ID
31+
32+
.Parameter ChildFolderId
33+
[sr-en] Mail folder child folder identifier
34+
[sr-de] Mailordner-Unterordner ID
35+
36+
.Parameter MessageId
37+
[sr-en] Id of the message
38+
[sr-de] Mail ID
39+
40+
.Parameter Properties
41+
[sr-en] List of properties to expand. Use * for all properties
42+
[sr-de] Liste der zu anzuzeigenden Eigenschaften. Verwenden Sie * für alle Eigenschaften
43+
#>
44+
45+
param(
46+
[Parameter(Mandatory = $true)]
47+
[string]$UserId,
48+
[Parameter(Mandatory = $true)]
49+
[string]$MailFolderId,
50+
[Parameter(Mandatory = $true)]
51+
[string]$ChildFolderId,
52+
[string]$MessageId,
53+
[ValidateSet('Subject','Id','BodyPreview','Categories','ConversationId','ConversationIndex','CreatedDateTime',
54+
'Extensions','HasAttachments','Importance','InferenceClassification','InternetMessageHeaders','InternetMessageId',
55+
'IsDeliveryReceiptRequested','IsDraft','IsRead','IsReadReceiptRequested','LastModifiedDateTime',
56+
'MultiValueExtendedProperties','ParentFolderId','ReceivedDateTime','SentDateTime','WebLink')]
57+
[string[]]$Properties = @('Subject','Id','BodyPreview','ReceivedDateTime','SentDateTime','Categories')
58+
)
59+
60+
Import-Module Microsoft.Graph.Mail
61+
62+
try{
63+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'
64+
'UserId' = $UserId
65+
'MailFolderId' = $MailFolderId
66+
'MailFolderId1' = $ChildFolderId
67+
}
68+
if($PSBoundParameters.ContainsKey('MessageId') -eq $true){
69+
$cmdArgs.Add('MessageId',$MessageId)
70+
}
71+
$result = Get-MgUserMailFolderChildFolderMessage @cmdArgs | Sort-Object -Descending ReceivedDateTime | Select-Object $Properties
72+
73+
if (Get-Command 'ConvertTo-ResultHtml' -ErrorAction Ignore) {
74+
ConvertTo-ResultHtml -Result $result
75+
}
76+
if($SRXEnv) {
77+
$SRXEnv.ResultMessage = $result
78+
}
79+
else{
80+
Write-Output $result
81+
}
82+
}
83+
catch{
84+
throw
85+
}
86+
finally{
87+
}

0 commit comments

Comments
 (0)