Pantelisy
Pantelisy

Reputation: 93

List deleted channels using MS Graph

I am trying to create a channel through MS Graph. Although if there was a deleted channel with this name i am getting this error:

Error message: Channel name already existed, please use other name.

As far as i know every deleted object is remaining for some days as deleted object in order to be able to recover it. Given that i need to list every deleted channel in order to avoid the errors created from MS Graph and return my own log message. Is there any way to list those channel and get their name through MS Graph?

graphClient.directory().deletedItems().buildRequest().get(); command did not help a lot as i was able to get the id of the deleted items and their oDataType but not their name.

Upvotes: 0

Views: 913

Answers (2)

unknown
unknown

Reputation: 7483

As user2250152 said, you couldn't get the soft deleted channels. And there is also no way to hard delete deleted channels, see here.

If you would like to create the channel immediately, you could restore the deleted one, then rename and delete it. Currently, Graph APIs to restore channel is not available.

Follow these steps to restore channel: https://learn.microsoft.com/en-us/archive/blogs/uclobby/restore-deleted-teams-and-channels-from-microsoft-teams

Upvotes: 1

user2250152
user2250152

Reputation: 20723

According to the issue. There is no way to get list of deleted channels once it is deleted.

I think that deleted channels stay in soft delete state for 24 hours. Maybe you can create channel with same name after 24 hours.

Upvotes: 1

Related Questions