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

Commit 7ea10fa

Browse files
Merge pull request #2187 from SharePoint/dev
August 2018 Release
2 parents 199beb0 + 30a37d7 commit 7ea10fa

26 files changed

+1065
-600
lines changed
Binary file not shown.

Binaries/SharePointPnP.Modernization.Framework.xml

+343-172
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

Binaries/release/SharePointPnP.Modernization.Framework.xml

+343-172
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

+26-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,28 @@ 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.12.1908.0]
9+
10+
### Added
11+
- Added -ResetRoleInheritance to Set-PnPList
12+
- Documentation updates
13+
- Added a TemplateId parameter to Apply-PnPProvisioningTemplate to allow to apply a specific template in case multiple templates exist in a single file.
14+
15+
### Changed
16+
17+
- Fixed potential issue when using -CurrentCredentials with Connect-PnPOnline in an on-premises context
18+
- Fixed bug in Set-PnPListItem when using SystemUpdate and setting a content type.
19+
- Grant-PnPTenantServicePrincipalPermission now handles multi-language environments where the Tenant App Catalog is in a different language than English.
20+
- Save-PnPProvisioningTemplate, if saving an instance to a PnP file, will now store referenced files etc in the PnP file.
21+
22+
### Contributors
23+
24+
- Lars Fernhomberg [lafe]
25+
- Chris O'Connor [kachihro]
26+
- Koen Zomers [KoenZomers]
27+
- Gautam Sheth [gautamdsheth]
28+
- Andres Mariano Gorzelany [get-itips]
29+
830
## [3.11.1907.0]
931

1032
### Added
@@ -14,9 +36,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
1436
### Changed
1537

1638
- ConvertTo-PnPClientSidePage: Added support for specifying a custom URL mapping file (UrlMappingFile parameter)
39+
- Get-PnPField: Return managed metadata fields as TaxonomyField instead of generic Field (#2130)
40+
- Submit-PnPSearchQuery: Added alias Invoke-PnPSearchQuery for semantic aligning the verbs (#2168)
41+
- Copy-PnPFile: Bugfix (#2103 #2148)
1742

1843
### Contributors
19-
44+
- Andi Krüger [andikrueger]
2045

2146
## [3.10.1906.0]
2247

Commands/Apps/GrantTenantServicePrincipalPermission.cs

+28-21
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,37 @@ protected override void ExecuteCmdlet()
3131
{
3232
var packageName = $"pnp-temporary-request-{System.Guid.NewGuid()}";
3333
var appCatalog = Tenant.GetAppCatalog();
34-
using (var appCatalogContext = ClientContext.Clone(appCatalog))
34+
if (appCatalog != null)
3535
{
36-
var list = appCatalogContext.Web.Lists.GetByTitle("Web Api Permission Requests");
37-
var itemCI = new ListItemCreationInformation();
38-
var item = list.AddItem(itemCI);
39-
item["_ows_PackageName"] = packageName;
40-
item["_ows_PackageVersion"] = "0.0.0.0";
41-
item["_ows_Scope"] = Scope;
42-
item["_ows_ResourceId"] = Resource;
43-
item.Update();
44-
appCatalogContext.ExecuteQueryRetry();
45-
}
36+
using (var appCatalogContext = ClientContext.Clone(appCatalog))
37+
{
38+
var list = appCatalogContext.Web.GetListByUrl("Lists/WebApiPermissionRequests");
39+
var itemCI = new ListItemCreationInformation();
40+
var item = list.AddItem(itemCI);
41+
item["_ows_PackageName"] = packageName;
42+
item["_ows_PackageVersion"] = "0.0.0.0";
43+
item["_ows_Scope"] = Scope;
44+
item["_ows_ResourceId"] = Resource;
45+
item.Update();
46+
appCatalogContext.ExecuteQueryRetry();
47+
}
4648

47-
var servicePrincipal = new SPOWebAppServicePrincipal(ClientContext);
48-
var requests = ClientContext.LoadQuery(servicePrincipal.PermissionRequests.Where(r => r.PackageName == packageName));
49-
ClientContext.ExecuteQueryRetry();
50-
if (requests.Any())
51-
{
52-
var newRequest = requests.First();
53-
var request = servicePrincipal.PermissionRequests.GetById(newRequest.Id);
54-
var grant = request.Approve();
55-
ClientContext.Load(grant);
49+
var servicePrincipal = new SPOWebAppServicePrincipal(ClientContext);
50+
var requests = ClientContext.LoadQuery(servicePrincipal.PermissionRequests.Where(r => r.PackageName == packageName));
5651
ClientContext.ExecuteQueryRetry();
57-
WriteObject(new TenantServicePrincipalPermissionGrant(grant));
52+
if (requests.Any())
53+
{
54+
var newRequest = requests.First();
55+
var request = servicePrincipal.PermissionRequests.GetById(newRequest.Id);
56+
var grant = request.Approve();
57+
ClientContext.Load(grant);
58+
ClientContext.ExecuteQueryRetry();
59+
WriteObject(new TenantServicePrincipalPermissionGrant(grant));
60+
}
61+
}
62+
else
63+
{
64+
WriteWarning("Tenant app catalog is not available. You must create the tenant app catalog before executing this command");
5865
}
5966
}
6067
}

Commands/Base/ConnectOnline.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ namespace SharePointPnP.PowerShell.Commands.Base
9292
#if !ONPREMISES
9393
#if !NETSTANDARD2_0
9494
[CmdletExample(
95-
Code = "PS:> Connect-PnPOnline -Scopes $arrayOfScopes",
96-
Remarks = "Connects to Azure AD and gets and OAuth 2.0 Access Token to consume the Microsoft Graph API including the declared permission scopes. The available permission scopes are defined at the following URL: https://graph.microsoft.io/en-us/docs/authorization/permission_scopes",
95+
Code = "PS:> Connect-PnPOnline -Scopes \"Mail.Read\",\"Files.Read\"",
96+
Remarks = "Connects to Azure AD and gets and OAuth 2.0 Access Token to consume the Microsoft Graph API including the declared permission scopes. The available permission scopes are defined at the following URL: https://docs.microsoft.com/en-us/graph/permissions-reference",
9797
SortOrder = 13)]
9898
#endif
9999
#endif

Commands/Base/SPOnlineConnectionHelper.cs

+6
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,12 @@ internal static SPOnlineConnection InstantiateSPOnlineConnection(Uri url, PSCred
577577
{
578578
context.Credentials = new NetworkCredential(credentials.UserName, credentials.Password);
579579
}
580+
else
581+
{
582+
// If current credentials should be used, use the DefaultNetworkCredentials of the CredentialCache. This has the same effect
583+
// as using "UseDefaultCredentials" in a HttpClient.
584+
context.Credentials = CredentialCache.DefaultNetworkCredentials;
585+
}
580586
}
581587
#if SP2013 || SP2016 || SP2019
582588
var connectionType = ConnectionType.OnPrem;

Commands/Base/deprecated/ConnectPnPMicrosoftGraph.deprecated.cs

-67
This file was deleted.

Commands/Base/deprecated/GetAzureADManifestKeyCredentials.deprecated.cs

-52
This file was deleted.

Commands/Branding/AddJavaScriptLink.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace SharePointPnP.PowerShell.Commands.Branding
88
{
99
[Cmdlet(VerbsCommon.Add, "PnPJavaScriptLink")]
10-
[CmdletHelp("Adds a link to a JavaScript file to a web or sitecollection",
10+
[CmdletHelp("Adds a link to a JavaScript file to a web or sitecollection, valid only for SharePoint classic site experience.",
1111
"Creates a custom action that refers to a JavaScript file",
1212
Category = CmdletHelpCategory.Branding)]
1313
[CmdletExample(Code = "PS:> Add-PnPJavaScriptLink -Name jQuery -Url https://code.jquery.com/jquery.min.js -Sequence 9999 -Scope Site",

Commands/Fields/GetField.cs

+11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Linq;
33
using System.Management.Automation;
44
using Microsoft.SharePoint.Client;
5+
using Microsoft.SharePoint.Client.Taxonomy;
56
using SharePointPnP.PowerShell.CmdletHelpAttributes;
67
using SharePointPnP.PowerShell.Commands.Base;
78
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;
@@ -145,6 +146,7 @@ protected override void ExecuteCmdlet()
145146
}
146147
ClientContext.Load(field, RetrievalExpressions);
147148
ClientContext.ExecuteQueryRetry();
149+
148150
switch (field.FieldTypeKind)
149151
{
150152
case FieldType.DateTime:
@@ -208,6 +210,15 @@ protected override void ExecuteCmdlet()
208210
WriteObject(ClientContext.CastTo<FieldNumber>(field));
209211
break;
210212
}
213+
case FieldType.Invalid:
214+
{
215+
if (field.TypeAsString.StartsWith("TaxonomyFieldType"))
216+
{
217+
WriteObject(ClientContext.CastTo<TaxonomyField>(field));
218+
break;
219+
}
220+
goto default;
221+
}
211222
default:
212223
{
213224
WriteObject(field);

Commands/Files/CopyFile.cs

+42-12
Original file line numberDiff line numberDiff line change
@@ -114,26 +114,52 @@ protected override void ExecuteCmdlet()
114114
_sourceContext = ClientContext.Clone(sourceWebUri);
115115
}
116116

117-
File file = _sourceContext.Web.GetFileByServerRelativeUrl(SourceUrl);
118-
Folder folder = _sourceContext.Web.GetFolderByServerRelativeUrl(SourceUrl);
119-
file.EnsureProperties(f => f.Name, f => f.Exists);
120-
#if !SP2013
121-
folder.EnsureProperties(f => f.Name, f => f.Exists);
122-
bool srcIsFolder = folder.Exists;
123-
#else
124-
folder.EnsureProperties(f => f.Name);
125-
bool srcIsFolder;
117+
bool isFile = true;
118+
bool srcIsFolder = false;
119+
120+
File file = null;
121+
Folder folder = null;
122+
126123
try
127124
{
128-
folder.EnsureProperties(f => f.ItemCount); //Using ItemCount as marker if this is a file or folder
129-
srcIsFolder = true;
125+
#if ONPREMISES
126+
file = _sourceContext.Web.GetFileByServerRelativeUrl(SourceUrl);
127+
#else
128+
file = _sourceContext.Web.GetFileByServerRelativePath(ResourcePath.FromDecodedUrl(SourceUrl));
129+
#endif
130+
file.EnsureProperties(f => f.Name, f => f.Exists);
130131
}
131132
catch
132133
{
133-
srcIsFolder = false;
134+
isFile = false;
134135
}
135136

137+
if (!isFile)
138+
{
139+
#if ONPREMISES
140+
folder = _sourceContext.Web.GetFolderByServerRelativeUrl(SourceUrl);
141+
#else
142+
folder = _sourceContext.Web.GetFolderByServerRelativePath(ResourcePath.FromDecodedUrl(SourceUrl));
143+
#endif
144+
145+
#if !SP2013
146+
folder.EnsureProperties(f => f.Name, f => f.Exists);
147+
srcIsFolder = folder.Exists;
148+
#else
149+
folder.EnsureProperties(f => f.Name);
150+
151+
try
152+
{
153+
folder.EnsureProperties(f => f.ItemCount); //Using ItemCount as marker if this is a file or folder
154+
srcIsFolder = true;
155+
}
156+
catch
157+
{
158+
srcIsFolder = false;
159+
}
160+
136161
#endif
162+
}
137163

138164
if (Force || ShouldContinue(string.Format(Resources.CopyFile0To1, SourceUrl, TargetUrl), Resources.Confirm))
139165
{
@@ -149,7 +175,11 @@ protected override void ExecuteCmdlet()
149175
{
150176
var targetFile = UrlUtility.Combine(TargetUrl, file.Name);
151177
// If src/dst are on the same Web, then try using CopyTo - backwards compability
178+
#if ONPREMISES
152179
file.CopyTo(targetFile, OverwriteIfAlreadyExists);
180+
#else
181+
file.CopyToUsingPath(ResourcePath.FromDecodedUrl(targetFile), OverwriteIfAlreadyExists);
182+
#endif
153183
_sourceContext.ExecuteQueryRetry();
154184
return;
155185
}

0 commit comments

Comments
 (0)