cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
COlsch
Regular Visitor

Creating a new folder in a newly created Team/SharePoint document library fails

Hi,

I got a question concerning Microsoft Flow/PowerAutomate and the creation of folders within the document library of a newly generated team in Microsoft Teams.

 

A. THE CONTEXT

1. Within Microsoft flow I create a new team with the Microsoft Graph "Clone a team"-command based on my team-template with the exemplary id: "f17cff1c-4da7....". For example:

 

POST

https://graph.microsoft.com/v1.0/teams/f17cff1c-4da7-4848-9955-b91e6662ed79/clone

{

  "displayName": "Example",

  "description": "Exampl-Descriptuon",

  "mailNickname": "TestMailNickname",

  "partsToClone": "apps,tabs,settings,channels,members",

  "visibility": "public"

}

- and it just works fine. The new team based on the template is created.

 

2. Then I want to create a folder in the new SharePoint document library of the newly created team.

- Therefor I have to get a few ids, for example the “drive id”, based on the newly created groups id. For example

 

GET

https://graph.microsoft.com/v1.0/groups/d7edce0f-622b-45134-95af-98a555cebb67/drive/root:/General

 

 

B. THE PROBLEM

1. With the above mentioned “GET Drive” command I get the following error.

{

  "error": {

    "code": "itemNotFound",

    "message": "The resource could not be found.",

    "innerError": {

      "request-id": "90d21f45-7db6-454a-a460-e9c7761cd390",

      "date": "2020-01-09T16:02:24"

    }  }  }

 

2. But if I:

a.) create a delay in Microsoft Flow, before the above mentioned “GET Drive” command starts

b.) Open the newly created Microsoft team manually by browsing to it

c.) Open the "Files" Tab in the General Channel of the newly created team.

d.) Get an "Error" that the "Files aren't accessible at the moment”. (See screenshot)

Error-Opening-First.jpg

 

 

 

 

 

 

 

 

 

e.) Open the "Files" Tab once again,

f.) I can see the available SharePoint root folder “General”. (see screenshot)

Success-Opening-Second.jpg

 

 

 

 

 

 

 

 

 

 

3. If I did the above mentioned manually actions within time before the "GET Drive" Command in Flow starts, I get a successful 200 response from the "GET Drive" Command with a body like

 

{

  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#groups('e81b7b1f-2601-43d5-8e1c-a1bc7c3e6666')/drive/root...",

  "createdDateTime": "2020-01-07T11:11:28Z",

  "eTag": "\"{BC4CB7A8-3B3D-469A-8ZBE-9047F2EF49AE},1\"",

  "id": "01XQSC5ZVIW5GLYPJ3PJBI4PUXM7ZO6SNO",

  "lastModifiedDateTime": "2020-01-07T11:11:28Z",

  "name": "General",

  ...

  ...

 

that contains the ids I need for creating folders in it.

 

4. Then I use the "Create a new folder in a drive" command. For example:

 

https://graph.microsoft.com/v1.0/drives/b!HkE4eVN_l0KBXm4BKBWvtIKfr8Bn82356Dk6xR-JBBvim_gu079SwvTpVX...

 

{

  "name": "New Folder",

  "folder": {} }

 

- And it just works fine getting a 201 response.

 

D. THE CONCLUSION

1. Somehow it seems, that the drive is only created/accessible after I opened the document library of the newly created team within Microsoft Teams one time manually.

 

E. THE QUESTIONS

1. Is there a possibility to simulate my manual opening of the newly created document library?

2. Or is there another known way to create a folder within this document library of the newly created team?

 

Thanks in advance.

 

2 REPLIES 2
v-alzhan-msft
Community Support
Community Support

Hi @COlsch ,

 

I don't think it is possible to simulate manual open of the new created document library.

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

DyajAr
Regular Visitor

I am running most likely into the same problem. My scenario is that I do create successfully a channel through the Graph API. But the SharePoint folder is indeed missing (while it will immediately created if I go to the 'Files' tab in the Teams App).
Any suggestions if this can be realized such that I can place as part of the channel creation some initial content within the newly created folder?
I was thinking the other way round - catching the moment the folder is being created in a Flow action. But that looks at least an enormous effort as each team has its own SharePoint site and the Power Automate trigger has a SharePoint site scope. 

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Users online (3,200)