Skip to content
This repository was archived by the owner on Jan 19, 2021. It is now read-only.

Commit c55dc05

Browse files
Merge pull request #2099 from SharePoint/dev
May 2019 Intermediate Release 3
2 parents 1854f9d + d814c32 commit c55dc05

File tree

6 files changed

+79
-10
lines changed

6 files changed

+79
-10
lines changed
Binary file not shown.
Binary file not shown.

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55

66
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
77

8+
## [3.9.1905.3 - May 2019 Intermediate Release 3]
9+
10+
### Changed
11+
- Updatd core provisioning to handle token issue during extraction and reintroduced content type fieldlink reordering in the engine.
12+
813
## [3.9.1905.2 - May 2019 Intermediate Release 2]
914

1015
### Changed

Commands/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@
4848
// You can specify all the values or you can default the Build and Revision Numbers
4949
// by using the '*' as shown below:
5050
// [assembly: AssemblyVersion("1.0.*")]
51-
[assembly: AssemblyVersion("3.9.1905.2")]
52-
[assembly: AssemblyFileVersion("3.9.1905.2")]
51+
[assembly: AssemblyVersion("3.9.1905.3")]
52+
[assembly: AssemblyFileVersion("3.9.1905.3")]
5353
[assembly: InternalsVisibleTo("SharePointPnP.PowerShell.Tests")]

Commands/Provisioning/Tenant/ApplyTenantTemplate.cs

+71-7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using System.IO;
1414
using System.Linq;
1515
using System.Management.Automation;
16+
using System.Threading.Tasks;
1617

1718
namespace SharePointPnP.PowerShell.Commands.Provisioning.Tenant
1819
{
@@ -256,22 +257,85 @@ protected override void ExecuteCmdlet()
256257
}
257258
}
258259
}
259-
if (!string.IsNullOrEmpty(SequenceId))
260+
#if !ONPREMISES
261+
using (var provisioningContext = new PnPProvisioningContext((resource, scope) =>
260262
{
261-
Tenant.ApplyProvisionHierarchy(hierarchyToApply, SequenceId, applyingInformation);
262-
}
263-
else
263+
// Get Azure AD Token
264+
if (AccessToken != null)
265+
{
266+
// Authenticated using -Graph or using another way to retrieve the accesstoken with Connect-PnPOnline
267+
return Task.FromResult(AccessToken);
268+
}
269+
else if (SPOnlineConnection.CurrentConnection.PSCredential != null)
270+
{
271+
// Using normal credentials
272+
return Task.FromResult(TokenHandler.AcquireToken(resource, null));
273+
}
274+
else
275+
{
276+
// No token...
277+
return null;
278+
}
279+
}))
264280
{
265-
foreach (var sequence in hierarchyToApply.Sequences)
281+
#endif
282+
if (!string.IsNullOrEmpty(SequenceId))
266283
{
267-
Tenant.ApplyProvisionHierarchy(hierarchyToApply, sequence.ID, applyingInformation);
284+
Tenant.ApplyProvisionHierarchy(hierarchyToApply, SequenceId, applyingInformation);
268285
}
286+
else
287+
{
288+
if (hierarchyToApply.Sequences.Count > 0)
289+
{
290+
foreach (var sequence in hierarchyToApply.Sequences)
291+
{
292+
Tenant.ApplyProvisionHierarchy(hierarchyToApply, sequence.ID, applyingInformation);
293+
}
294+
}
295+
else
296+
{
297+
Tenant.ApplyProvisionHierarchy(hierarchyToApply, null, applyingInformation);
298+
}
299+
}
300+
#if !ONPREMISES
269301
}
270-
302+
#endif
271303
WriteObject(sitesProvisioned, true);
272304

273305
}
274306

307+
private string AccessToken
308+
{
309+
get
310+
{
311+
if (SPOnlineConnection.AuthenticationResult != null)
312+
{
313+
if (SPOnlineConnection.AuthenticationResult.ExpiresOn < DateTimeOffset.Now)
314+
{
315+
WriteWarning(Properties.Resources.MicrosoftGraphOAuthAccessTokenExpired);
316+
SPOnlineConnection.AuthenticationResult = null;
317+
return null;
318+
}
319+
else
320+
{
321+
#if !NETSTANDARD2_0
322+
return (SPOnlineConnection.AuthenticationResult.Token);
323+
#else
324+
return SPOnlineConnection.AuthenticationResult.AccessToken;
325+
#endif
326+
}
327+
}
328+
else if (SPOnlineConnection.CurrentConnection?.AccessToken != null)
329+
{
330+
return SPOnlineConnection.CurrentConnection.AccessToken;
331+
}
332+
else
333+
{
334+
return null;
335+
}
336+
}
337+
}
338+
275339

276340
private ProvisioningHierarchy GetHierarchy()
277341
{

version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.9.1905.2
1+
3.9.1905.3

0 commit comments

Comments
 (0)