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

Commit f05a9fc

Browse files
Merge pull request #1615 from SharePoint/dev
June 2018 Intermediate Release
2 parents ff784c8 + b33a014 commit f05a9fc

File tree

5 files changed

+55
-3
lines changed

5 files changed

+55
-3
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ 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-
## [Unreleased]
8+
## [2.28.1807.0] Unreleased
99
### Added
1010

1111
### Changed

Commands/Base/PnPGraphCmdlet.cs

+45
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
using SharePointPnP.PowerShell.Commands.Properties;
55
using System;
66
using System.Collections.Generic;
7+
using System.IO;
78
using System.Linq;
89
using System.Management.Automation;
10+
using System.Reflection;
911
using System.Text;
1012
using System.Threading.Tasks;
1113

@@ -16,6 +18,7 @@ namespace SharePointPnP.PowerShell.Commands.Base
1618
/// </summary>
1719
public abstract class PnPGraphCmdlet : PSCmdlet
1820
{
21+
private Assembly newtonsoftAssembly;
1922
public String AccessToken
2023
{
2124
get
@@ -49,11 +52,48 @@ public String AccessToken
4952
}
5053
}
5154

55+
private string AssemblyDirectory
56+
{
57+
get
58+
{
59+
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
60+
UriBuilder uri = new UriBuilder(codeBase);
61+
string path = Uri.UnescapeDataString(uri.Path);
62+
return Path.GetDirectoryName(path);
63+
}
64+
}
65+
66+
private void FixAssemblyResolving()
67+
{
68+
newtonsoftAssembly = System.Reflection.Assembly.LoadFrom(Path.Combine(AssemblyDirectory, "NewtonSoft.Json.dll"));
69+
System.AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
70+
71+
}
72+
73+
private System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
74+
{
75+
76+
if (args.Name.StartsWith("Newtonsoft.Json"))
77+
{
78+
return newtonsoftAssembly;
79+
}
80+
foreach (var assembly in System.AppDomain.CurrentDomain.GetAssemblies())
81+
{
82+
if (assembly.FullName == args.Name)
83+
{
84+
return assembly;
85+
}
86+
}
87+
return null;
88+
}
89+
5290
protected override void BeginProcessing()
5391
{
5492

5593
base.BeginProcessing();
5694

95+
FixAssemblyResolving();
96+
5797
#if !NETSTANDARD2_0
5898

5999
if (SPOnlineConnection.CurrentConnection != null && SPOnlineConnection.CurrentConnection.ConnectionMethod == Model.ConnectionMethod.GraphDeviceLogin)
@@ -99,5 +139,10 @@ protected override void ProcessRecord()
99139
{
100140
ExecuteCmdlet();
101141
}
142+
143+
protected override void EndProcessing()
144+
{
145+
System.AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
146+
}
102147
}
103148
}

Commands/Branding/AddCustomAction.cs

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ namespace SharePointPnP.PowerShell.Commands.Branding
1818
Add-PnPCustomAction -Name 'GetItemsCount' -Title 'Invoke GetItemsCount Action' -Description 'Adds custom action to custom list ribbon' -Group 'SiteActions' -Location 'CommandUI.Ribbon' -CommandUIExtension $cUIExtn",
1919
Remarks = @"Adds a new custom action to the custom list template, and sets the Title, Name and other fields with the specified values. On click it shows the number of items in that list. Notice: escape quotes in CommandUIExtension.",
2020
SortOrder = 1)]
21+
[CmdletExample(Code = @"Add-PnPCustomAction -Title ""CollabFooter"" -Name ""CollabFooter"" -Location ""ClientSideExtension.ApplicationCustomizer"" -ClientSideComponentId c0ab3b94-8609-40cf-861e-2a1759170b43 -ClientSideComponentProperties ""{`""sourceTermSet`"":`""PnP-CollabFooter-SharedLinks`"",`""personalItemsStorageProperty`"":`""PnP-CollabFooter-MyLinks`""}",
22+
Remarks = @"Adds a new application customizer to the site. This requires that an SPFX solution has been deployed containing the application customizer specified.",
23+
SortOrder = 2)]
2124
[CmdletRelatedLink(
2225
Text = "UserCustomAction",
2326
Url = "https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.usercustomaction.aspx")]

Commands/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@
4444
// You can specify all the values or you can default the Build and Revision Numbers
4545
// by using the '*' as shown below:
4646
// [assembly: AssemblyVersion("1.0.*")]
47-
[assembly: AssemblyVersion("2.27.1806.0")]
48-
[assembly: AssemblyFileVersion("2.27.1806.0")]
47+
[assembly: AssemblyVersion("2.27.1806.1")]
48+
[assembly: AssemblyFileVersion("2.27.1806.1")]
4949
[assembly: InternalsVisibleTo("SharePointPnP.PowerShell.Tests")]

Commands/Taxonomy/ImportTaxonomy.cs

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ namespace SharePointPnP.PowerShell.Commands.Taxonomy
1818
Code = @"PS:> Import-PnPTaxonomy -Terms 'Company|Locations|Stockholm|Central','Company|Locations|Stockholm|North'",
1919
Remarks = "Creates a new termgroup, 'Company', a termset 'Locations', a term 'Stockholm' and two subterms: 'Central', and 'North'",
2020
SortOrder = 2)]
21+
[CmdletExample(
22+
Code = @"PS:> Import-PnPTaxonomy -Path ./mytaxonomyterms.txt",
23+
Remarks = "Imports the taxonomy from the file specified. Each line has to be in the format TERMGROUP|TERMSET|TERM. See example 2 for examples of the format.",
24+
SortOrder = 3)]
2125
public class ImportTaxonomy : PnPCmdlet
2226
{
2327

0 commit comments

Comments
 (0)