This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0"?> | |
| <pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2019/03/ProvisioningSchema"> | |
| <pnp:Preferences Generator="OfficeDevPnP.Core, Version=3.9.1905.0, Culture=neutral, PublicKeyToken=null" /> | |
| <pnp:Templates ID="CONTAINER-TEMPLATE-189597059C6B4C3FB113CE057D982E8E"> | |
| <pnp:ProvisioningTemplate ID="TEMPLATE-189597059C6B4C3FB113CE057D982E8E" Version="1" BaseSiteTemplate="SITEPAGEPUBLISHING#0" Scope="RootSite"> | |
| <pnp:Theme Name="Orange" IsInverted="false" /> | |
| </pnp:ProvisioningTemplate> | |
| </pnp:Templates> | |
| </pnp:Provisioning> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| string userName = "admin@tenant.onmicrosoft.com"; | |
| string password = "<your-password>"; | |
| string siteUrl = "https://<tenant>.sharepoint.com/sites/testsite/"; | |
| using (ClientContext clientContext = new ClientContext(siteUrl)) | |
| { | |
| SecureString securePassword = new SecureString(); | |
| foreach (char c in password.ToCharArray()) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var appcatalog = clientContext.Site.RootWeb.SiteCollectionAppCatalog; | |
| clientContext.Load(appcatalog); | |
| clientContext.ExecuteQueryRetry(); | |
| if (appcatalog.ServerObjectIsNull) | |
| { | |
| // app catalog doesn't exist | |
| } | |
| else | |
| { | |
| // app catalog exists |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var appCatalogSites = clientContext.Web.TenantAppCatalog.SiteCollectionAppCatalogsSites; | |
| clientContext.Load(appCatalogSites); | |
| clientContext.ExecuteQuery(); | |
| foreach (var site in appCatalogSites) | |
| { | |
| Console.WriteLine(site.AbsoluteUrl); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var siteUrl = "https://<tenant-name>.sharepoint.com/sites/test" | |
| using (ClientContext clientContext = new ClientContext(siteUrl)) | |
| { | |
| try | |
| { | |
| // removes the site collection app catalog | |
| // do note- it will disable the app catalog and not hide it from the UI | |
| // this is a SharePoint thing, since App Catalog is basically a document library underneath | |
| clientContext.Web.TenantAppCatalog.SiteCollectionAppCatalogsSites.Remove(siteUrl); | |
| clientContext.ExecuteQueryRetry(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var siteUrl = "https://<tenant-name>.sharepoint.com/sites/test" | |
| using (ClientContext clientContext = new ClientContext(siteUrl)) | |
| { | |
| try | |
| { | |
| // activate the site collection app catalog | |
| clientContext.Web.TenantAppCatalog.SiteCollectionAppCatalogsSites.Add(siteUrl); | |
| clientContext.ExecuteQueryRetry(); | |
| } | |
| catch (Exception ex) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Connect-PnPOnline "https://tenant.sharepoint.com/sites/Test" | |
| $webpartXML = [IO.File]::ReadAllText("C:\Users\Admin\Desktop\highlightedContentWebpart.webpart") | |
| Add-PnPWebPartToWikiPage -ServerRelativePageUrl "/sites/Test/Pages/TestPage.aspx" -Xml $webpartXML -Row 1 -Column 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| onnect-PnPOnline "https://tenant.sharepoint.com/sites/Test" | |
| $webpartXML = [IO.File]::ReadAllText("C:\Users\Admin\Desktop\peopleModernWebpart.dwp") | |
| Add-PnPWebPartToWikiPage -ServerRelativePageUrl "/sites/Test/Pages/TestPage.aspx" -Xml $webpartXML -Row 1 -Column 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <webParts> | |
| <webPart xmlns="http://schemas.microsoft.com/WebPart/v3"> | |
| <metaData> | |
| <type name="Microsoft.SharePoint.WebPartPages.ClientSideWebPart, | |
| Microsoft.SharePoint, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> | |
| <importErrorMessage>Cannot Import WebPart</importErrorMessage> | |
| </metaData> | |
| <data> | |
| <properties> | |
| <property name="Title" type="string">People</property> |