Skip to main content

Hi 

I managed to get a zap to create a folder in a sharepoint site for any new customer.

Once created, I need the URL that would allow any people to have read access to the folder (a shared link).

This can be done with Ms PowerAutomate with the following code.

Thanks

 

Code from Power Automate

{

    "inputs": {

        "host": {

            "connectionName": "shared_sharepointonline",

            "operationId": "CreateSharingLink",

            "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline"

        },

        "parameters": {

            "dataset": "https://MYDOMAIN.sharepoint.com/",

            "table": "2d76b717-5fc2-428-9e37-10e895",

            "id": "@outputs('Create folder)?'body/ID']",

            "permission/type": "view",

            "permission/scope": "anonymous"

        },

        "authentication": "@parameters('$authentication')"

    },

    "metadata": {

        "operationMetadataId": "f376f-8756-b3-bb87-04fa5ccee4"

    }

}

Hi there, ​@Nikol. Welcome to the Community! 🎉

There doesn’t appear to be any share links returned with the Create Folder (Microsoft Sharepoint) action and I couldn’t see any field or separate action available that would allow you to set the sharing preferences of the folder. So I’d recommend reaching out to our Support team to submit a new feature request for that functionality to be added. You can do that here: https://zapier.com/app/get-help

In the meantime, I wonder if you could use an API Request (Microsoft Sharepoint) action (see: Set up an API request action) to generate a sharing link for the folder?

Looking at Microsoft’s API documentation there’s an endpoint for creating a sharing link for a driveItem: Create a sharing link for a DriveItem. And according to their API documentation here folders are considered to be ‘driveItems’:

034f11dcff1f3580e537e0f9be8a699c.png

So in theory that should do the trick.🤞

It’s a bit more advanced than Microsoft Sharepoint’s other actions but I’d be happy to lend a hand if you give that a try and get stuck at all!


Hi ​@SamB 

Thanks for taking time on this issue. I tried to go on with your API idea.

 

Indeed, it seems that the following http request coud be used:

POST /sites/{siteId}/drive/items/{itemId}/createLink

When creating the sharepoint folder, my output data contains a “Unique Id” field that could be the “itemID” ; but I cannot find a “siteID”

It is a pity because the json is quite simple to do the trick:

{ "type": "view", "scope": "anonymous" }

and I could get “webUrl" response I am looking for.

 

Do you know how get the {siteId} to put in the post (sites/{siteId}/drive/items/{itemId}/createLink) ?

 

Thanks in advance


Happy to help ​@Nikol! 🙂

If you’ve got a Create Folder (Microsoft SharePoint) action in the Zap as well then you can likely find the ID in the Site field. The ID should appear in the list of available sites under the relevant site’s name. 

I’ve not got a Microsoft SharePoint account so I can’t show you a direct example, but you can see the sort thing I mean in the following screenshot, where the IDs appear directly under the name of the option:

7984418c5c9ddce3982af6240cb734da.png

That said, if for some reason the ID isn’t appearing please do let me know—want to ensure you’re all set! 


Reply