Skip to content

Commit

Permalink
#1007, #706 , #462 - fix Add-PnPTeamsTeam issue (#1013)
Browse files Browse the repository at this point in the history
* Downgraded dependencies to handle Az DLLs

* Fix #916 - added PnP alias for commands

* Added SiteAlias for New-PnPSite, Principals for PnPHubSite

* Updated docs

* Fixed output for hub site registration.

* Fix #990 - fix for odata.nextLink issue

* #840 - added NoCrawl parameter to disable SPList indexing

* Docs update

* #1007 - fix for Add-PnPTeamsTeam issue
  • Loading branch information
gautamdsheth committed Aug 13, 2021
1 parent 257f945 commit 542cabb
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions src/Commands/Site/AddTeamsTeam.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
using PnP.Framework.Sites;

using Microsoft.SharePoint.Client;
using PnP.Framework.Sites;
using PnP.PowerShell.Commands.Attributes;
using PnP.PowerShell.Commands.Base;
using PnP.PowerShell.Commands.Utilities;
using System;
using System.Management.Automation;

namespace PnP.PowerShell.Commands.Site
{
[Cmdlet(VerbsCommon.Add, "PnPTeamsTeam")]
public class AddTeamsTeam : PnPSharePointCmdlet
[RequiredMinimalApiPermissions("Group.ReadWrite.All")]
public class AddTeamsTeam : PnPGraphCmdlet
{

protected override void ExecuteCmdlet()
{
var results = SiteCollection.TeamifySiteAsync(ClientContext);
var returnedBool = results.GetAwaiter().GetResult();
WriteObject(returnedBool);
try
{
var results = SiteCollection.TeamifySiteAsync(ClientContext);
var returnedBool = results.GetAwaiter().GetResult();
WriteObject(returnedBool);
}
catch(Exception)
{
try
{
var groupId = ClientContext.Site.EnsureProperty(s => s.GroupId);
Microsoft365GroupsUtility.CreateTeamAsync(HttpClient, AccessToken, groupId).GetAwaiter().GetResult();
}
catch
{
throw;
}
}

}
}
}

0 comments on commit 542cabb

Please sign in to comment.