Create modern team site in SPFx
I found some articles which are explaining creating modern sites with CSOM. But I am not able to find in JavaScript to use in SPFx.
Creating modern sites is supported with SPFx? Any PnP extension available for this?
sharepoint-online javascript spfx spfx-webparts modern-experience
add a comment |
I found some articles which are explaining creating modern sites with CSOM. But I am not able to find in JavaScript to use in SPFx.
Creating modern sites is supported with SPFx? Any PnP extension available for this?
sharepoint-online javascript spfx spfx-webparts modern-experience
add a comment |
I found some articles which are explaining creating modern sites with CSOM. But I am not able to find in JavaScript to use in SPFx.
Creating modern sites is supported with SPFx? Any PnP extension available for this?
sharepoint-online javascript spfx spfx-webparts modern-experience
I found some articles which are explaining creating modern sites with CSOM. But I am not able to find in JavaScript to use in SPFx.
Creating modern sites is supported with SPFx? Any PnP extension available for this?
sharepoint-online javascript spfx spfx-webparts modern-experience
sharepoint-online javascript spfx spfx-webparts modern-experience
edited Dec 7 '18 at 12:35
Gautam Sheth
24.1k12048
24.1k12048
asked Dec 7 '18 at 12:27
MihirMihir
75351942
75351942
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You can use the PnPJS to create modern team and communication sites.
For that, simply add the below packages:
npm install @pnp/logging @pnp/common @pnp/odata @pnp/sp --save
After that, you can add the below import statement:
import { sp } from "@pnp/sp";
And in the webpart, you can use it as below to create modern sites:
1) Modern communication sites:
sp.site.createCommunicationSite(
"Comm Site Title",
1033,
true,
"https://tenant.sharepoint.com/sites/commSite",
).then(d => {
console.log(d);
});
2) Modern team site:
sp.site.createModernTeamSite(
"displayName",
"alias",
true,
1033,
"description",
"",
["user1@tenant.onmicrosoft.com","user2@tenant.onmicrosoft.com","user3@tenant.onmicrosoft.com"])
.then(d => {
console.log(d);
});
Reference - PnPJS Sites
1
I don't see the point to have two identical answers.. so deleted mine despite I answered a bit earlier than you...
– Sergei Sergeev
Dec 7 '18 at 14:52
add a comment |
You can do that with the most recent version (1.2.6) of PnPjs library:
import { sp } from "@pnp/sp";
sp.site.createModernTeamSite(
"displayName",
"alias",
true,
1033,
"description",
"HBI",
["user1@tenant.onmicrosoft.com","user2@tenant.onmicrosoft.com","user3@tenant.onmicrosoft.com"])
.then(d => {
console.log(d);
});
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "232"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsharepoint.stackexchange.com%2fquestions%2f253918%2fcreate-modern-team-site-in-spfx%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use the PnPJS to create modern team and communication sites.
For that, simply add the below packages:
npm install @pnp/logging @pnp/common @pnp/odata @pnp/sp --save
After that, you can add the below import statement:
import { sp } from "@pnp/sp";
And in the webpart, you can use it as below to create modern sites:
1) Modern communication sites:
sp.site.createCommunicationSite(
"Comm Site Title",
1033,
true,
"https://tenant.sharepoint.com/sites/commSite",
).then(d => {
console.log(d);
});
2) Modern team site:
sp.site.createModernTeamSite(
"displayName",
"alias",
true,
1033,
"description",
"",
["user1@tenant.onmicrosoft.com","user2@tenant.onmicrosoft.com","user3@tenant.onmicrosoft.com"])
.then(d => {
console.log(d);
});
Reference - PnPJS Sites
1
I don't see the point to have two identical answers.. so deleted mine despite I answered a bit earlier than you...
– Sergei Sergeev
Dec 7 '18 at 14:52
add a comment |
You can use the PnPJS to create modern team and communication sites.
For that, simply add the below packages:
npm install @pnp/logging @pnp/common @pnp/odata @pnp/sp --save
After that, you can add the below import statement:
import { sp } from "@pnp/sp";
And in the webpart, you can use it as below to create modern sites:
1) Modern communication sites:
sp.site.createCommunicationSite(
"Comm Site Title",
1033,
true,
"https://tenant.sharepoint.com/sites/commSite",
).then(d => {
console.log(d);
});
2) Modern team site:
sp.site.createModernTeamSite(
"displayName",
"alias",
true,
1033,
"description",
"",
["user1@tenant.onmicrosoft.com","user2@tenant.onmicrosoft.com","user3@tenant.onmicrosoft.com"])
.then(d => {
console.log(d);
});
Reference - PnPJS Sites
1
I don't see the point to have two identical answers.. so deleted mine despite I answered a bit earlier than you...
– Sergei Sergeev
Dec 7 '18 at 14:52
add a comment |
You can use the PnPJS to create modern team and communication sites.
For that, simply add the below packages:
npm install @pnp/logging @pnp/common @pnp/odata @pnp/sp --save
After that, you can add the below import statement:
import { sp } from "@pnp/sp";
And in the webpart, you can use it as below to create modern sites:
1) Modern communication sites:
sp.site.createCommunicationSite(
"Comm Site Title",
1033,
true,
"https://tenant.sharepoint.com/sites/commSite",
).then(d => {
console.log(d);
});
2) Modern team site:
sp.site.createModernTeamSite(
"displayName",
"alias",
true,
1033,
"description",
"",
["user1@tenant.onmicrosoft.com","user2@tenant.onmicrosoft.com","user3@tenant.onmicrosoft.com"])
.then(d => {
console.log(d);
});
Reference - PnPJS Sites
You can use the PnPJS to create modern team and communication sites.
For that, simply add the below packages:
npm install @pnp/logging @pnp/common @pnp/odata @pnp/sp --save
After that, you can add the below import statement:
import { sp } from "@pnp/sp";
And in the webpart, you can use it as below to create modern sites:
1) Modern communication sites:
sp.site.createCommunicationSite(
"Comm Site Title",
1033,
true,
"https://tenant.sharepoint.com/sites/commSite",
).then(d => {
console.log(d);
});
2) Modern team site:
sp.site.createModernTeamSite(
"displayName",
"alias",
true,
1033,
"description",
"",
["user1@tenant.onmicrosoft.com","user2@tenant.onmicrosoft.com","user3@tenant.onmicrosoft.com"])
.then(d => {
console.log(d);
});
Reference - PnPJS Sites
answered Dec 7 '18 at 12:33
Gautam ShethGautam Sheth
24.1k12048
24.1k12048
1
I don't see the point to have two identical answers.. so deleted mine despite I answered a bit earlier than you...
– Sergei Sergeev
Dec 7 '18 at 14:52
add a comment |
1
I don't see the point to have two identical answers.. so deleted mine despite I answered a bit earlier than you...
– Sergei Sergeev
Dec 7 '18 at 14:52
1
1
I don't see the point to have two identical answers.. so deleted mine despite I answered a bit earlier than you...
– Sergei Sergeev
Dec 7 '18 at 14:52
I don't see the point to have two identical answers.. so deleted mine despite I answered a bit earlier than you...
– Sergei Sergeev
Dec 7 '18 at 14:52
add a comment |
You can do that with the most recent version (1.2.6) of PnPjs library:
import { sp } from "@pnp/sp";
sp.site.createModernTeamSite(
"displayName",
"alias",
true,
1033,
"description",
"HBI",
["user1@tenant.onmicrosoft.com","user2@tenant.onmicrosoft.com","user3@tenant.onmicrosoft.com"])
.then(d => {
console.log(d);
});
add a comment |
You can do that with the most recent version (1.2.6) of PnPjs library:
import { sp } from "@pnp/sp";
sp.site.createModernTeamSite(
"displayName",
"alias",
true,
1033,
"description",
"HBI",
["user1@tenant.onmicrosoft.com","user2@tenant.onmicrosoft.com","user3@tenant.onmicrosoft.com"])
.then(d => {
console.log(d);
});
add a comment |
You can do that with the most recent version (1.2.6) of PnPjs library:
import { sp } from "@pnp/sp";
sp.site.createModernTeamSite(
"displayName",
"alias",
true,
1033,
"description",
"HBI",
["user1@tenant.onmicrosoft.com","user2@tenant.onmicrosoft.com","user3@tenant.onmicrosoft.com"])
.then(d => {
console.log(d);
});
You can do that with the most recent version (1.2.6) of PnPjs library:
import { sp } from "@pnp/sp";
sp.site.createModernTeamSite(
"displayName",
"alias",
true,
1033,
"description",
"HBI",
["user1@tenant.onmicrosoft.com","user2@tenant.onmicrosoft.com","user3@tenant.onmicrosoft.com"])
.then(d => {
console.log(d);
});
answered Dec 7 '18 at 12:31
Sergei SergeevSergei Sergeev
10.2k52342
10.2k52342
add a comment |
add a comment |
Thanks for contributing an answer to SharePoint Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsharepoint.stackexchange.com%2fquestions%2f253918%2fcreate-modern-team-site-in-spfx%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown