Read deleted group owners with Graph API - microsoft-graph-api

Is there any way to list the owners of a recently deleted group with Graph API? I need to build a process with PowerAutomate to inform all the owners that their group is deleted.
With PowerShell I get this far:
Get-UnifiedGroup -Identity $guid -IncludeSoftDeletedGroups
Then I get a list of owners under the ManagedBy property, to bad, they are AD usernames only, not emails.
With Graph, I don't even get this far, I didn't find an an equivalent of the IncludeSoftDeletedGroups parameter and when I query for a deleted group I simply get an error that it doesn't exist. Can somebody please give me a hint?

https://graph.microsoft.com/v1.0/directory/deletedItems/microsoft.graph.group
This is the call you need to do to get the recently deletedItems for groups(microsoft.graph.group). Please check this DeletedItems Doc.
Currently, there is no way to get the owners from deleted items, please raise the UserVoice

Related

MS graph user has multiple calendars with name 'calendar'

we are using software to push events to calendars using MS Graph, however 2 of the users are getting errors saying the user has multiple calendars with the name 'Calendar'
When i use the MS graph explorer on
https://developer.microsoft.com/en-us/graph/graph-explorer
I can see that there are 2 calendars setup the same, but with different ID's.
however in outlook and O365 online, and on the exchange admin console, i cannot see the 2 calendars only the one.
Is there somewhere that we can get to the calendars and either combine them or remove one?
Thanks in advance.
Programmatically ids only will help you to differentiate. To overcome the scenario, i would suggest you to rename the calendar names in a meaningful way in the UI. If its not showing in UI, it means the calendar folder might be hidden.
You updated that you will have a go at renaming it, then will go for the delete if you cant resolve it, as the user doesn't use the calendar much.
I ran into this issue on one mailbox, and came here to post the resolution as I had to dig around and piece together a way to resolve it.
I'm sure there's a way to add the correct MS Graph permissions to an admin account to resolve this without logging in as the user, but I couldn't get that part right so here's what I did:
Took a backup of the user calendar just in case.
Verified only one calendar named "Calendar" was displaying in Outlook.
Have the user login to the MS Graph site as themselves.
https://developer.microsoft.com/en-us/graph/graph-explorer.
If you need to verify the UUID for this user, GET their UUID by running the default query:
https://graph.microsoft.com/v1.0/me/
GET the associated calendars with their mailbox, you can search "calendar" in the sample queries menu to find "GET all my calendars" or you can just paste this in and run the query:
https://graph.microsoft.com/v1.0/me/calendars
You may need to click "Modify permissions" and consent to the permission to read calendar items. If so, you'll receive a notification in the MS Graph query.
With this, I found two calendars named 'calendar', but only one of them was marked as "isRemoveable":true,
Note down this UUID
Again this command may prompt to give additional permissions, but using the reference at https://learn.microsoft.com/en-us/graph/api/calendar-delete?view=graph-rest-1.0&tabs=http I ran the following command:
Choose DELETE in the drop-down, append the command /me/calendars/{CALENDAR UUID} and run it.
You will receive a confirmation message that almost looks like an error. Green-colored response "No Content - 204"
At this point, test the sync again. The user had no ill-effects from this as the offending calendar wasn't even in use/visible in Outlook.

Microsoft Groups/Teams: Can't create plans for Planner App

I created a Group using
https://learn.microsoft.com/en-us/graph/api/group-post-groups?view=graph-rest-1.0&tabs=http
and then used
https://learn.microsoft.com/en-us/graph/api/team-put-teams?view=graph-rest-1.0&tabs=http
to create a Team. Now I am facing issue when adding a plan using a Planner app
"Failed to create the plan."
How I can fix this issue?
In my investigations, I found that the other team members are able to create plans. As an owner of the team, I am not able to create them. if I am trying graph API I'm getting an error:
You do not have the required permissions to access this item, or the item may not exist.
I'm glad you came right and that I was able to help. I'm updating the answer so that it's more clear on a few points:
Technically, this actually has nothing to do with Teams at all, it relates to Office 365 Groups, which forms the core underneath Teams, Planner, and more. You actually link in your question to the Groups docs, incidentally. I've updated the question title to reflect this.
I haven't tested this exactly, but I doubt that it needs your account exactly in the Owners and Members - I suspect the main constraint is that there needs to be at least one person in each of those roles (that means there has to be at least one Owner and at least one Member). Arguably, this is actually a bug in Planner, but it was maybe never detected by Microsoft because if you create a Group from the web interface, it automatically puts your user in as Owner and Member.
If you do put your own account into both positions, but that's not what you want long term, you could probably just take them out after creating the Planner plan.
Just a reminder that best practice is to have more than one owner of a Group, in case/when the original Owner is not/no longer available.
It's fixed after adding the creator of teams as a member too. So I had to add the user who is creating Teams in Team members too.
I made sure that there was another owner on the Team, demoted and removed the owner and the re-added them to the team. This resolved the issue that I had with multiple teams

MS Graph API endpoint /v1.0/me/planner/plans doesn't return all my plans

In the past I was reading a list of plans of current user with this REST call of the beta-API:
https://graph.microsoft.com/beta/me/plans
In July 2017 the planner API was released and there are also some minor changes to the endpoints, so the REST call in the V1.0-API now is:
https://graph.microsoft.com/v1.0/me/planner/plans
Unfortunately I do not receive all my plans with that endpoint. Apparently I only get plans that exist for a long time, but any newly created plans are not visible. I tried a lot of actions on my plans like subscribing to, assigning tasks to me, favorize the plan in planner hub, making a plan public or private, but nothing helps, new plans remain invisible in the API.
Can anybody explain what the new endpoint exactly does? The documentation for List plans is not very helpfull.
Can anybody explain how I can a list of all plans (title and id) that I am owner or member of?
The only work-around I have found so far is:
1) Read all unified groups
https://graph.microsoft.com/v1.0/me/memberOf/$/microsoft.graph.group?$filter=groupTypes/any(a:a eq 'unified')
2) for each group: read the planner plan for that group
https://graph.microsoft.com/v1.0/groups/<id>/planner/plans
But that would require one request per group, makeing performance horrible on tenants with dozens of groups.
This API returns plans that have been shared with the current user. Plans can be shared with a user by adding the user's id to sharedWith property of planDetails (Edit: currently users do not have permissions to add or remove others from this list). This is a separate set of users from group membership and does not allow access to data for shared users. Instead, the users will have access if they are group members, and lose access if they are removed from the group.
More information and a sample for updating plan details can be found here.
Additionally, you can submit feedback about the API (and other Planner functionality) here.

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

How to list the deleted contacts by Microsoft Graph API

I want to do a sync action in my client side, so need to know how to get all deleted contact list.
By the api (GET /me/contacts), I could get all contact list
But it wastes much time when the user has large contacts.
This api (GET /me/contacts/{id}) tell us the contact is exist or not.
it is inefficient to check every contacts are deleted or not for me.
Which apis do I use? thanks for your help.
Why not use the delta query preview in the /beta endpoint? That should do what you want.
More efficient way for you to check which contacts were removed is getting just the list of contact ID's and then doing the diff between list of ID's returned by graph, and local list.
You can use query parameters to retrieve just the ID's of the contacts, instead of getting the whole objects.
Method url:
https://graph.microsoft.com/v1.0/me/contacts?$select=id

Resources