Office 365 Groups - Create Default OneNote Document - microsoft-graph-api

We're creating Office 365 Groups using a PowerShell script, and this process in place already and we're happy with it.
I was wondering however, if it was possible to trigger the creation of the default OneNote document via the Graph API at all? It appears as though when a Group is created, it's not until someone manually visits the Document library and clicks the OneNote document, is it actually created (on the fly). I have arrived at this conclusion because if we run a Get-UnifiedGroup on the group itself (storing the result in $Group), the following property is empty: $Group.SharePointNotebookUrl
The reason we'd like to do this, is so we can create Office 365 Groups and populate the default OneNote notebook with some information, without having to have a user with permission to the group, manually trigger the creation of it. I'm able to create additional notebooks in the Group, but these are not 'presented' in the same way to end users that the default one is (with it's own dedicated tabs/menu links).

This isn't possible from Microsoft Graph today. As you noted, the default OneNote for a Group is created the first time you attempt to access it. It's also a little different in that it gets places in a SiteAssetts library which also doesn't exist when the group is created.
I recommend visiting the UserVoice and adding this as a suggestion.

Office 365 default Notebook is a file in SiteAssets library in the associated SharePoint site.
If Notebook is not created yet, you can create by enabling SharePoint Feature SiteNotebook with Id f151bb39-7c3b-414f-bb36-6bf18872052f
With PnP PowerShell:
Enable-PnPFeature -Identity f151bb39-7c3b-414f-bb36-6bf18872052f -Scope Web
This will create Notebook in SiteAssets library and adds PropertyBag to SPWeb with name "SiteNotebookGuid".

Related

Graph unable to update permissions for an external user

Recently something is changed the way Graph is handling permissions on drive items for external(outside tenant users).
Previously when we give access Write access to an external a unique link was created per user that we can do a patch call to update the roles if we want.
Now only two links are created one which is common for all externals having write role and one for read role.
I could not find a way if I want to update the role of an external from write to read or vice versa without removing all external users with write and adding them again.
Is there a work around to update permissions for external. The documentation is also pretty old its not updated since 2017.
Note: This is the Endpoint we are using/recommended to update permissions.

Adding Students with the API and Class Notebook

I'm using the Graph API to construct a simple Dashboard for Teachers and Students. Everything works well except that when a Student is added they do not get access to the Class Notebook and they don't get a Section Group for them created in the Class Notebook.
Notably, if I open the Class in Microsoft Teams and add or remove anyone from it then all of the users that have been added through the API get access and their section groups created correctly.
This behavior seems to happen both with .Education.Classes["..."].Members and Groups["..."].Members. The Members added this way also don't show up in the Teams "Manage Members" interface but I'm not concerned about that.
I'm using the v1.0 endpoint, and OneDrive and Sharepoint permissions all work as expected.
My question is do I have to do something extra to get the Class Notebook updated with the membership or are there some additional properties that need to be sent when adding a user or is this just a bug?
The Class Notebook doesn't automatically watch the group membership. Rather experiences that add members need to use Class Notebook APIs to do the matching update.
Unfortunately, the Class Notebook APIs aren't yet available directly on the Microsoft graph, so you have to switch over to the OneNote API endpoint (refresh your token with that as the resource) and make the call there.
This is the API you need

Microsoft Graph set unified group default notebook

I have a scenario where I'm trying to provision a group and pre-populate the one note with template pages.
Doing posts to https://graph.microsoft.com/v1.0/groups/<groupid>/onenote/notebooks and subsequent endpoints I'm able to create everything.
However whenever the user goes to outlook, and clicks on the OneNotes button, it creates a brand new notebook which is empty.
The question is: how can I set my notebook to be the default of the group?
Thanks!
After some more investigation the default notebook for the group is created automatically after the group creation. There doesn't seem to be a way to change the default notebook at the moment.
The creation of that notebook can take some time (undocumented at the moment) which can range from a couple of milliseconds to minutes so your code should plan for that as well.
Finally, after being created, the notebook can take additional time to appear in the UI (like when adding a tab in Microsoft Teams)

Caller not authenticated when attempting access sharepoint list using Microsoft graph

Trying to use Microsoft's Graph beta to access a Sharepoint list via a registered Azure app using a key. I'm able to successful see/access some lists(looks like only lists created when site was created), but any list I have manually created is missing.
I can do the following get to list most lists in my site:
https://graph.microsoft.com/beta/sites/contoso.sharepoint.com,fc016e3c-d8ae-4ee0-a10c-de6d26788b6a,9a4ea7a5-c3c4-44ae-9f80-273bd67431b8\lists
but for some reason it's only displaying certain lists and none of the ones I created. However if enter the list's GUID like this
https://graph.microsoft.com/beta/sites/contoso.sharepoint.com,fc016e3c-d8ae-4ee0-a10c-de6d26788b6a,9a4ea7a5-c3c4-44ae-9f80-273bd67431b8/lists/BEA4B4A9-323F-441A-BA19-806290B27EF6
I receive "the caller is not authenticated" message back. This is message has me thinking it's a permissions issue, however, my list permissions are the same on all lists. it's as if the graph api can only see lists created by the system and not by end users.
Anybody experiencing this issue?
I've seen this issue on my end. The "save item to list" function works for some accounts and not others... It's extremely weird! Typical SharePoint, I suppose.
What I've come to realize is that GRAPH will sometimes throw an error when trying to save data to a date field and works every time saving data to text fields. If I'm logged in as my main O365 account (with license) I can save to date fields. If I'm logged in with a basic user that I just created on the domain (no license) I can create items unless there's a date field.
If I come up with anything else I'll post it! Sorry, this is more of a work-around than an answer. Hopefully it will spark something else.
Thanks

Adding Outlook appointment using ASP.Net

I am creating an ASP.Net MVC project where users will add Outlook appointments to other users calendars. I other words; I wish for a user of my web app to be able to add an appointment directly in another persons calendar. This means sending it via email with no need for the receiver to accept it. It should be as if the receiver actually created it himself in Outlook.
Is this even possible to do?
The web app is hosted outside the customers network.
Best regards
Pål Eilertsen
You can create an ICS file that the user can double click and store the appointment. If multiple users, it can be sent to others. If you can get access to their exchange server (sounds like you can't), as SLaks asked, you can use something like this (http://goo.gl/G2nrd). If you have no access to Exchange directly, the ICS file format will allow the user to add the appointment.
If you want an example of an ics file (other than a Google search), sign up for a Microsoft event and click the "add to outlook" button. The fortunate thing about this methodology is it can also work with other mail/calendar applications that use the format.

Resources