Skip to content

Commit b611be0

Browse files
erwinvanhunengautamdshethGautam ShethKoenZomers
authored
New graph helper (#4617)
* Update use of GraphHelper * Renamed GraphHelper to ApiRequestHelper * Simplified examples * simplified URL * renamed file and updated url handling * Nightly publish to PowerShell Gallery * Update to version checker * Rewrote to use tracelog and added Format-PnPTraceLog cmdlet * Added automatic login: more work to do * switched to settings.json * Nightly publish to PowerShell Gallery * Add ExtendPermissionsToUnprotectedFiles parameter to Set-PnPTenant cmdlet (#4602) Co-authored-by: Gautam Sheth <[email protected]> * Nightly publish to PowerShell Gallery * Added deprecation notice on the SharePoint Mail API * Nightly publish to PowerShell Gallery * Added paramset for working with doclibs * Finalized implementation of Get-PnPFolderItem * Added same logic to Get-PnPFileInFolder and Get-PnPFolderInFolder as well * Added changelog entry * moved from cachesettings.json to settings.json * Updated handling of tracelog * refactored private field name * Updated tracelogging * renamed file * Updated tracelogging cmdlets * Nightly publish to PowerShell Gallery * removed unneeded include * Removed unused usings * Fixed using * Changed warning message * Updated cleaning * Updated cache enabled message * Fixed JSON escaping in log message --------- Co-authored-by: Gautam Sheth <[email protected]> Co-authored-by: Gautam Sheth <[email protected]> Co-authored-by: Koen Zomers <[email protected]>
1 parent 472a561 commit b611be0

File tree

564 files changed

+1675
-2515
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

564 files changed

+1675
-2515
lines changed

documentation/Invoke-PnPGraphMethod.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,48 +96,48 @@ Set the new displayName of the group with a Patch request.
9696

9797
### Example 4
9898
```powershell
99-
Invoke-PnPGraphMethod -Url "v1.0/users?$filter=accountEnabled ne true&$count=true" -Method Get -ConsistencyLevelEventual
99+
Invoke-PnPGraphMethod -Url "users?`$filter=accountEnabled ne true&`$count=true" -Method Get -ConsistencyLevelEventual
100100
```
101101

102102
Get users with advanced query capabilities. Use of -ConsistencyLevelEventual.
103103

104104
### Example 5
105105
```powershell
106-
Invoke-PnPGraphMethod -Url "https://graph.microsoft.com/v1.0/users"
106+
Invoke-PnPGraphMethod -Url "users"
107107
```
108108

109109
Performs a GET request to retrieve users from the Microsoft Graph API using the full URL.
110110

111111
### Example 6
112112
```powershell
113-
Invoke-PnPGraphMethod -Url "https://graph.microsoft.com/v1.0/users/[email protected]/photo/`$value" -OutFile c:\temp\photo.jpg
113+
Invoke-PnPGraphMethod -Url "users/[email protected]/photo/`$value" -OutFile c:\temp\photo.jpg
114114
```
115115

116116
Downloads the user profile photo of the specified user to the specified file.
117117

118118
### Example 7
119119
```powershell
120-
Invoke-PnPGraphMethod -Url "https://graph.microsoft.com/v1.0/users/[email protected]/photo/`$value" -OutStream | Add-PnPFile -FileName user.jpg -Folder "Shared Documents"
120+
Invoke-PnPGraphMethod -Url "users/[email protected]/photo/`$value" -OutStream | Add-PnPFile -FileName user.jpg -Folder "Shared Documents"
121121
```
122122

123123
Takes the user profile photo of the specified user and uploads it to the specified library in SharePoint Online.
124124

125125
### Example 8
126126
```powershell
127-
$task = Invoke-PnPGraphMethod -Url "https://graph.microsoft.com/v1.0/planner/tasks/23fasefxcvzvsdf32e" # retrieve the task so we can figure out the etag which is needed to update the task
127+
$task = Invoke-PnPGraphMethod -Url "planner/tasks/23fasefxcvzvsdf32e" # retrieve the task so we can figure out the etag which is needed to update the task
128128
$etag = $task.'@odata.etag'
129129
$headers = @{"If-Match"=$etag}
130130
$content = @{"title"="My new task title"}
131-
Invoke-PnPGraphMethod -Url "https://graph.microsoft.com/v1.0/planner/tasks/23fasefxcvzvsdf32e" -Method PATCH -Content $content -AdditionalHeaders $headers
131+
Invoke-PnPGraphMethod -Url "planner/tasks/23fasefxcvzvsdf32e" -Method PATCH -Content $content -AdditionalHeaders $headers
132132
```
133133

134134
This example retrieves a Planner task to find the etag value which is required to update the task. In order to update the task through call to the Microsoft Graph API we need to include an If-Match header with the value of the etag. It then creates the content to update, in this case the title of the task, and calls the PATCH method on the Graph end-point to update the specific task.
135135

136136
### EXAMPLE 9
137137
```powershell
138138
$batch = New-PnPBatch -RetainRequests
139-
Invoke-PnPSPRestMethod -Method Get -Url "https://graph.microsoft.com/v1.0/users" -Batch $batch
140-
Invoke-PnPSPRestMethod -Method Get -Url "https://graph.microsoft.com/v1.0/groups" -Batch $batch
139+
Invoke-PnPSPRestMethod -Method Get -Url "users" -Batch $batch
140+
Invoke-PnPSPRestMethod -Method Get -Url "groups" -Batch $batch
141141
$response = Invoke-PnPBatch $batch -Details
142142
$response
143143
```

src/Commands/Admin/AddHomeSite.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
using Microsoft.SharePoint.Client;
33
using PnP.PowerShell.Commands.Base;
44
using System.Management.Automation;
5-
using PnP.PowerShell.Commands.Base.PipeBinds;
6-
using PnP.Core.Model;
7-
using System;
85

96
namespace PnP.PowerShell.Commands.Admin
107
{

src/Commands/Admin/AddHubToHubAssociation.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
using Microsoft.Online.SharePoint.TenantAdministration;
22
using Microsoft.SharePoint.Client;
3-
43
using PnP.PowerShell.Commands.Base;
54
using System.Management.Automation;
6-
using PnP.PowerShell.Commands.Base.PipeBinds;
75
using System;
86

97
namespace PnP.PowerShell.Commands.Admin

src/Commands/Admin/AddOrgAssetsLibrary.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Microsoft.SharePoint.Client;
2-
32
using PnP.PowerShell.Commands.Base;
43
using System.Management.Automation;
54
using Microsoft.Online.SharePoint.TenantAdministration;

src/Commands/Admin/GetContainer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using Microsoft.SharePoint.Client;
44
using PnP.PowerShell.Commands.Base;
55
using PnP.PowerShell.Commands.Base.PipeBinds;
6-
using PnP.PowerShell.Commands.Model.SharePoint;
76
using System;
87
using System.Collections.Generic;
98
using System.Management.Automation;

src/Commands/Admin/GetContainerType.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
using Microsoft.Online.SharePoint.TenantAdministration;
22
using Microsoft.SharePoint.Client;
33
using PnP.PowerShell.Commands.Base;
4-
using PnP.PowerShell.Commands.Base.PipeBinds;
5-
using PnP.PowerShell.Commands.Utilities;
6-
using System;
74
using System.Collections.Generic;
85
using System.Management.Automation;
96

src/Commands/Admin/GetDeletedContainer.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
using Microsoft.Online.SharePoint.TenantAdministration;
22
using Microsoft.SharePoint.Client;
33
using PnP.PowerShell.Commands.Base;
4-
using PnP.PowerShell.Commands.Base.PipeBinds;
5-
using PnP.PowerShell.Commands.Utilities;
6-
using System;
74
using System.Collections.Generic;
85
using System.Management.Automation;
96

src/Commands/Admin/GetHubSite.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Microsoft.SharePoint.Client;
2-
32
using PnP.PowerShell.Commands.Base;
43
using PnP.PowerShell.Commands.Base.PipeBinds;
54
using System.Management.Automation;

src/Commands/Admin/GetStorageEntity.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System.Linq;
2-
using System.Management.Automation;
1+
using System.Management.Automation;
32
using Microsoft.SharePoint.Client;
43
using PnP.PowerShell.Commands.Enums;
54
using System.Collections.Generic;

src/Commands/Admin/GetTenant.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Microsoft.SharePoint.Client;
2-
32
using PnP.PowerShell.Commands.Base;
43
using System.Management.Automation;
54
using PnP.PowerShell.Commands.Model;

0 commit comments

Comments
 (0)