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

Commit

Permalink
Merge pull request #1615 from SharePoint/dev
Browse files Browse the repository at this point in the history
June 2018 Intermediate Release
  • Loading branch information
erwinvanhunen committed Jun 13, 2018
2 parents ff784c8 + b33a014 commit f05a9fc
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.

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

## [Unreleased]
## [2.28.1807.0] Unreleased
### Added

### Changed
Expand Down
45 changes: 45 additions & 0 deletions Commands/Base/PnPGraphCmdlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
using SharePointPnP.PowerShell.Commands.Properties;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Management.Automation;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

Expand All @@ -16,6 +18,7 @@ namespace SharePointPnP.PowerShell.Commands.Base
/// </summary>
public abstract class PnPGraphCmdlet : PSCmdlet
{
private Assembly newtonsoftAssembly;
public String AccessToken
{
get
Expand Down Expand Up @@ -49,11 +52,48 @@ public String AccessToken
}
}

private string AssemblyDirectory
{
get
{
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
return Path.GetDirectoryName(path);
}
}

private void FixAssemblyResolving()
{
newtonsoftAssembly = System.Reflection.Assembly.LoadFrom(Path.Combine(AssemblyDirectory, "NewtonSoft.Json.dll"));
System.AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;

}

private System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{

if (args.Name.StartsWith("Newtonsoft.Json"))
{
return newtonsoftAssembly;
}
foreach (var assembly in System.AppDomain.CurrentDomain.GetAssemblies())
{
if (assembly.FullName == args.Name)
{
return assembly;
}
}
return null;
}

protected override void BeginProcessing()
{

base.BeginProcessing();

FixAssemblyResolving();

#if !NETSTANDARD2_0

if (SPOnlineConnection.CurrentConnection != null && SPOnlineConnection.CurrentConnection.ConnectionMethod == Model.ConnectionMethod.GraphDeviceLogin)
Expand Down Expand Up @@ -99,5 +139,10 @@ protected override void ProcessRecord()
{
ExecuteCmdlet();
}

protected override void EndProcessing()
{
System.AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
}
}
}
3 changes: 3 additions & 0 deletions Commands/Branding/AddCustomAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ namespace SharePointPnP.PowerShell.Commands.Branding
Add-PnPCustomAction -Name 'GetItemsCount' -Title 'Invoke GetItemsCount Action' -Description 'Adds custom action to custom list ribbon' -Group 'SiteActions' -Location 'CommandUI.Ribbon' -CommandUIExtension $cUIExtn",
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.",
SortOrder = 1)]
[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`""}",
Remarks = @"Adds a new application customizer to the site. This requires that an SPFX solution has been deployed containing the application customizer specified.",
SortOrder = 2)]
[CmdletRelatedLink(
Text = "UserCustomAction",
Url = "https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.usercustomaction.aspx")]
Expand Down
4 changes: 2 additions & 2 deletions Commands/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.27.1806.0")]
[assembly: AssemblyFileVersion("2.27.1806.0")]
[assembly: AssemblyVersion("2.27.1806.1")]
[assembly: AssemblyFileVersion("2.27.1806.1")]
[assembly: InternalsVisibleTo("SharePointPnP.PowerShell.Tests")]
4 changes: 4 additions & 0 deletions Commands/Taxonomy/ImportTaxonomy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ namespace SharePointPnP.PowerShell.Commands.Taxonomy
Code = @"PS:> Import-PnPTaxonomy -Terms 'Company|Locations|Stockholm|Central','Company|Locations|Stockholm|North'",
Remarks = "Creates a new termgroup, 'Company', a termset 'Locations', a term 'Stockholm' and two subterms: 'Central', and 'North'",
SortOrder = 2)]
[CmdletExample(
Code = @"PS:> Import-PnPTaxonomy -Path ./mytaxonomyterms.txt",
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.",
SortOrder = 3)]
public class ImportTaxonomy : PnPCmdlet
{

Expand Down

0 comments on commit f05a9fc

Please sign in to comment.