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
| // add video embed web part.. | |
| ClientSideWebPart videoEmbedWp = page.InstantiateDefaultWebPart(DefaultClientSideWebParts.VideoEmbed); | |
| videoEmbedWp.Properties["videoSource"] = "https://chrisobriensp.sharepoint.com/portals/hub/_layouts/15/PointPublishing.aspx?app=video&p=p&chid=4b7ef33e-ed56-4c75-b3ad-61488cc82474&vid=1e07b31d-21fa-4326-9033-91adf1a90708"; | |
| videoEmbedWp.Properties["captionText"] = "ALM video"; | |
| videoEmbedWp.Properties["showInfo"] = false; | |
| videoEmbedWp.Properties["embedCode"] = "<iframe width=853 height=480 src='https://chrisobriensp.sharepoint.com/portals/hub/_layouts/15/VideoEmbedHost.aspx?chId=4b7ef33e%2Ded56%2D4c75%2Db3ad%2D61488cc82474&vId=1e07b31d%2D21fa%2D4326%2D9033%2D91adf1a90708&width=853&height=480&autoPlay=false&showInfo=true' allowfullscreen></iframe>"; | |
| videoEmbedWp.Title = "Associated video"; | |
| page.AddControl(videoEmbedWp); | |
| // add Yammer embed web part.. |
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
| private static void addDefaultWebPartToPageSimple(ClientContext siteContext, string pageName) | |
| { | |
| ClientSidePage page = new ClientSidePage(siteContext); | |
| ClientSideWebPart videoEmbedWp = page.InstantiateDefaultWebPart(DefaultClientSideWebParts.VideoEmbed); | |
| page.AddControl(videoEmbedWp); | |
| page.Save(pageName); | |
| } |
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
| private static void createPage(ClientContext siteContext, string pageName) | |
| { | |
| ClientSidePage page = new ClientSidePage(siteContext); | |
| ClientSideText txt1 = new ClientSideText() { Text = "COB test" }; | |
| page.AddControl(txt1, 0); | |
| // page will be created if it doesn't exist, otherwise overwritten if it does.. | |
| page.Save(pageName); | |
| } |
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
| private static void addCustomSPFxWebPartToPage(ClientContext siteContext, string wpName, string pageName, int wpOrder) | |
| { | |
| // create page example.. | |
| ClientSidePage page = new ClientSidePage(siteContext); | |
| // modify existing page example.. | |
| //ClientSidePage page = ClientSidePage.Load(siteContext, pageName); | |
| // get the available web parts - this collection will include OOTB and custom SPFx web parts.. | |
| var components = page.AvailableClientSideComponents(); |
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
| private static void addModernWebPartToPage(ClientContext siteContext) | |
| { | |
| Console.WriteLine(string.Format("addModernWebPartToPage(): Entered.")); | |
| // get page context - the actual name/page instance is specified in the Save() method.. | |
| ClientSidePage page = new ClientSidePage(siteContext); | |
| // get the available web parts - this collection will include OOTB and custom SPFx web parts.. | |
| var components = page.AvailableClientSideComponents(); |
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
| PropertyPaneLink('', { | |
| href: 'https://www.sharepointnutsandbolts.com', | |
| text: 'COB blog', | |
| target: '_blank', | |
| popupWindowProps: { | |
| height: 500, | |
| width: 500, | |
| positionWindowPosition: 2, | |
| title: 'COB blog' | |
| } |
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
| PropertyPaneSlider('maxResultsProp', { | |
| label: 'Max results', | |
| min: 1, | |
| max: 20, | |
| step: 2, | |
| showValue: true, | |
| value: 10 | |
| }) |
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
| PropertyPaneToggle('toBeProp', { | |
| key: 'toBeToggle', | |
| label: 'To be or not to be?', | |
| onText: 'To be!', | |
| offText: 'Not to be' | |
| }) |
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
| PropertyPaneChoiceGroup('layoutProp', { | |
| label: 'Choices', | |
| options: [ | |
| { key: '2Cols', text: 'Two columns' }, | |
| { key: '3Cols', text: 'Three columns', checked: true }, | |
| { key: 'Horizontal', text: 'Horizontal' } | |
| ] | |
| }), |
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
| PropertyPaneChoiceGroup('FileType', { | |
| label: 'File type:', | |
| options: [ | |
| { key: 'Word', text: 'Word', | |
| imageSrc: 'https://static2.sharepointonline.com/files/fabric/assets/brand-icons/document/png/docx_32x1.png', | |
| imageSize: { width: 32, height: 32 }, | |
| selectedImageSrc: 'https://static2.sharepointonline.com/files/fabric/assets/brand-icons/document/png/docx_32x1.png' | |
| }, | |
| { key: 'Excel', text: 'Excel', | |
| imageSrc: 'https://static2.sharepointonline.com/files/fabric/assets/brand-icons/document/png/xlsx_32x1.png', |