Pnp-sites-core: Create Modern Site in App Only Context

Created on 13 Oct 2017  路  15Comments  路  Source: pnp/PnP-Sites-Core

Category

[ ] Bug
[x] Enhancement

Environment

[x] Office 365 / SharePoint Online
[ ] SharePoint 2016
[ ] SharePoint 2013

Expected or Desired Behavior

In provisioning scenario, we definitely need to create site in app only context. It's not desired to store tenant admin and password in config file or something else.
Actually when we create a site with c# code or PowerShell (New-PnPSite) in a App Only ClientContext, we just received exception :
pnpmissingfeature

PowerShell Example
Connect-PnPOnline -Url $spUrl -AppId $appId -AppSecret $appSecret
New-PnPSite -Type TeamSite -Title TestAppOnly -Alias AppOnly -Description Test -IsPublic
C# Example

```C#
using (ClientContext cc = Client.GetAppOnlyClientContext())
{
var creationInformation = new OfficeDevPnP.Core.Sites.TeamSiteCollectionCreationInformation();
creationInformation.DisplayName = "Test";
creationInformation.Alias = "AppOnly";
creationInformation.Classification = string.Empty;
creationInformation.Description = string.Empty;
creationInformation.IsPublic = true;

var results = cc.CreateSiteAsync(creationInformation);
var returnedContext = results.GetAwaiter().GetResult();

}
```

@jansenbe do you plan to support a such scenario in a near future ?

Thanks for your help and your work 馃憤

Most helpful comment

There's, unfortunately, no new development for this area. Our initial estimate was by end of the year, but unfortunately, that was changed. I cannot provide updated ETA for now.

All 15 comments

Unfortunately, app-only provisioning of modern sites through native SP REST APIs is not supported yet (will be in future). Technically you can use app-only if you create the group using graph end-point, but not yet using the native REST API, which this command set is using. When the app-only will be natively supported, our existing code will support that natively. Should be resolved by end of this year (2017).

Thanks @VesaJuvonen for your quick answer.

@VesaJuvonen Is there any update on this capability of using AppOnly? I know it says end of year but can't seem to find anything about it in the documentation.

@VesaJuvonen please can you share an update on this issue? You said on 13 Oct 2017 that it should be resolved by the end of the year. Today, on 05 Mar 2018, I still experience this issue with SharePointPnPCoreOnline version 2.23.1802. Thanks.

There's, unfortunately, no new development for this area. Our initial estimate was by end of the year, but unfortunately, that was changed. I cannot provide updated ETA for now.

Any update on this? This is really needed to automate site creation.

If there is demand for this requirement, please do open up a UserVoice entry at for collecting the votes, so that we can internally show the demand for the requirement. UserVoice is a great way to see how many others would need to have same capability - https://sharepoint.uservoice.com/forums/329220-sharepoint-dev-platform.

There's, unfortunately, no ask for the app-only in the UserVoice, so it's unclear how widely this capability would be needed, so would suggest to create one and then ask colleagues and friends who need it as well vote on it. Thx.

Should have included in the previous. Having this support in the PnP side is 100% dependent on having the support of the native APIs, which is why UserVoice voting would be needed.

It has been added to UserVoice, if anyone would like to vote it up.

@ultimateroryer And that UserVoice has been declined.

Hello Vesa, I am creating a webapi to be consumed from a reactjs Multitenant application, the idea is to be able to create modern sites frm this reactjs app. I have used app only for other operations, but for creation of the site I get the same error above.

Is there an ETA on this?
Is there an alternative in how to create modern sites?
@VesaJuvonen

UserVoice is now done.
Check out the updated docs

Lets get it added to the PnP component asap 馃槃

I am trying to provision team site with the group using app-only token in SharePoint online but it giving App Only is currently not supported.

Does it really supported or not?

@anomepani Creating groups from App Only context does'nt seem to be supported in the SP API's, only sites with no group is supported.

Was this page helpful?
0 / 5 - 0 ratings