Forum Discussion
Malene Friborg
Feb 20, 2018Iron Contributor
calendar web part on modern pages
Any chance we can get an ordinary calendar web part on our modern pages?
Events web part is not enough and the group calendar is only for, well, groups :-) We have the need for a modern page with ...
YuliyaHarada
Microsoft
Feb 23, 2018hi Malene,
You can workaround this by adding an embed webpart to your modern page with this iframe code:
<iframe width="100%" height="1000px" src="https://xxx.sharepoint.com/sites/xxx/Lists/Calendar/calendar.aspx" scrolling="no" style="margin-left: -200px; margin-top: -190px;">
</iframe>
You can workaround this by adding an embed webpart to your modern page with this iframe code:
<iframe width="100%" height="1000px" src="https://xxx.sharepoint.com/sites/xxx/Lists/Calendar/calendar.aspx" scrolling="no" style="margin-left: -200px; margin-top: -190px;">
</iframe>
Joy_Stantec
Jan 18, 2019Copper Contributor
Hi! I have been using this code to embed my calendars. Last week it magically stopped working and now the left and top nav that should be cut off with the margins are showing.
Any idea how to fix this and/or why it changed? No code changed on my pages. One minute the iframe margins worked, and the next time I opened the page, the iframe margins weren't working anymore.
- georg1Jan 24, 2019Brass Contributor
I'm having this exact problem with my calendar. I'm yet to try the script solution posted here, but I found an interim solution on reddit which may help some here:
Add ?isdlg=1 or &isdlg=1 to the end of your embedded address/URL. This popped up a bit of a spacey calendar, but it's better than the whole page. Hopefully Microsoft fixes this problem properly soon.
- Josef HermesMay 27, 2019Copper Contributor
georg1 many thanks! This indeed did the job for us. So, in summary: we used the embed webpart with this iframe code:
<iframe src="https://company.sharepoint.com/sites/yoursite/Lists/agenda/calendar.aspx?isDlg=1" width="100%" height="800px"></iframe>
- georg1Jul 16, 2019Brass ContributorGlad it helped!
- JHMSTechCommJan 18, 2019Copper Contributor
Below is an answer I received from Microsoft on a modification to the javascript in order to display the calendar in a better manner. I didn't want to modify the code for something that is fairly trivial for me so I can't say if this works or not. I also asked them what changed in the last week or so and they didn't have a response for that.
Microsoft Answer:
If only want to display the calendar in the modern experience page like this,
You can try these below steps,
- On the calendar page(which you want to display on the modern page), edit the page, add one content edit web part and insert below JavaScript code in the content edit web part,
<script>
function HideElementInFrame(Id)
{
ele = window.document.getElementById(Id);
if(ele)
{
ele.style.display="none";
}
}
var url = new URL(window.document.location.href);
var IsInIframe = url.searchParams.get("IsInIframe");
if(IsInIframe==1)
{
HideElementInFrame('s4-ribbonrow');
HideElementInFrame('s4-titlerow');
HideElementInFrame('zz12_V4QuickLaunchMenu');
HideElementInFrame('zz11_RootAspMenu');
HideElementInFrame('DeltaPlaceHolderSearchArea');
HideElementInFrame('suiteBarTop');
}
</script>
2. On the modern page, embed the calendar page with below code,
<iframe src="https://yourcompany.sharepoint.com/calendar.aspx?IsInIframe=1" scrolling="no" width="100%" height="1000px">
</iframe>
- MahmudaJan 03, 2020Copper Contributor
Hi Josh, JHMSTechComm
I am also attempting to get the full view of the calendar on to my modern SharePoint site. Once I click Edit Page, I do not see the Edit Source button to edit/enter a JavaScript code under HTML Source. See image below. Please let me know if I am missing a step?
Thanks,
Mahmuda
- DsienkowskiJan 03, 2020Copper Contributor
You need to add a Content Edit Web Part. See my comment above on how to do that. I've attached the web part if you need to import it like I did.
- Robin NilssonJan 18, 2019Bronze Contributor
This looks promising - it's like what I would do for on-premise SharePoint. However, there isn't a Content Editor Webpart available unless you turn on the publishing features for your site collection. Which might be a problem, or not - I've seen other posts about publishing features and unintended consequences but I don't remember what they actually said.
- NHarzicJan 21, 2019Iron Contributor
Thank you for this. I have implemented this solution and it does the trick. However, instead of putting the JavaScript in a Content Editor webpart on the source calendar page though, I used a script editor.
I will say that it does seem a shame to use embedded JavaScript when a fully-functional modern calendar webpart with options for re-sizing and styling would be so much better and more reliable. Hopefully this is something that the Microsoft development team is considering in the near future as it would really solve a lot of problems.
Thanks, Natalie