cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JDeng
Frequent Visitor

Alert When Site Visitor Adds File

Hi all,

 

I co-own a SharePoint site/Team with my partner and we would like to invite visitors onto the site to upload PDF files. We are currently doing this by going to the specific folder we want these files placed, and then sharing a link only to that folder to prevent access to other folders on the site. 

 

Is there a way to trigger alerts only when non-owners create/upload files onto the site?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
fchopo
Super User
Super User

Hi @JDeng 

You could do something like this:

1) When a new file is added to a specific document library (sorry, no trigger for creating a file for any document library).

2) Get members of site Member's group (user who are not owners but can edit content).

3) Parse the results (JSON) using the following schema:

{
    "type": "object",
    "properties": {
        "body": {
            "type": "object",
            "properties": {
                "d": {
                    "type": "object",
                    "properties": {
                        "results": {
                            "type": "array",
                            "items": {
                                "type": "object",
                                "properties": {
                                    "__metadata": {
                                        "type": "object",
                                        "properties": {
                                            "id": {
                                                "type": "string"
                                            },
                                            "uri": {
                                                "type": "string"
                                            },
                                            "type": {
                                                "type": "string"
                                            }
                                        }
                                    },
                                    "Id": {
                                        "type": "integer"
                                    },
                                    "Email": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "__metadata",
                                    "Id",
                                    "Email"
                                ]
                            }
                        }
                    }
                }
            }
        }
    }
}

4) For each member, add it to an array (store all the members' email addresses).

5) If the user who created the file (Created by Email Address) is contained in the array (using join operator we create a string like "userA@contoso.com;userB@contoso.com") means that he/she is not an owner, but can add content.

6) Send the alert email.

 

See screenshots below:

Part 1

flow-1.png

Part 2

flow-2.png

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

View solution in original post

2 REPLIES 2
fchopo
Super User
Super User

Hi @JDeng 

You could do something like this:

1) When a new file is added to a specific document library (sorry, no trigger for creating a file for any document library).

2) Get members of site Member's group (user who are not owners but can edit content).

3) Parse the results (JSON) using the following schema:

{
    "type": "object",
    "properties": {
        "body": {
            "type": "object",
            "properties": {
                "d": {
                    "type": "object",
                    "properties": {
                        "results": {
                            "type": "array",
                            "items": {
                                "type": "object",
                                "properties": {
                                    "__metadata": {
                                        "type": "object",
                                        "properties": {
                                            "id": {
                                                "type": "string"
                                            },
                                            "uri": {
                                                "type": "string"
                                            },
                                            "type": {
                                                "type": "string"
                                            }
                                        }
                                    },
                                    "Id": {
                                        "type": "integer"
                                    },
                                    "Email": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "__metadata",
                                    "Id",
                                    "Email"
                                ]
                            }
                        }
                    }
                }
            }
        }
    }
}

4) For each member, add it to an array (store all the members' email addresses).

5) If the user who created the file (Created by Email Address) is contained in the array (using join operator we create a string like "userA@contoso.com;userB@contoso.com") means that he/she is not an owner, but can add content.

6) Send the alert email.

 

See screenshots below:

Part 1

flow-1.png

Part 2

flow-2.png

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
JDeng
Frequent Visitor

Thank you so much, perfect.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (4,406)