Timer Azure function to update status in SHarepoint list

Moni gupta 1 Reputation point
2020-06-18T05:36:12.72+00:00

Hello,

I have below requirement:

New Azure Timer function TT-JS-PublicTeams-UpdatePrivacy
Read the SharePoint list "PublicTeams"

Get the list items satisfying filter on Privacy--
Privacy != TargetStatus

Use below graph api and change team's privacy
PATCH https://graph.microsoft.com/v1.0/groups/<<guid>>

Body-
{<!-- -->{"visibility":"<<target status>>"}}

after successful execution; update <<privacy>> column with <<target status>>

function should run everyday

How it can be done using Javascript?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,145 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Samara Soucy - MSFT 5,131 Reputation points
    2020-06-25T21:42:03.72+00:00

    Nicolás Bello Camilletti wrote a good guide on calling the Graph API with a Javascript function here: https://medium.com/southworks/calling-microsoft-graph-api-from-an-azure-function-using-javascript-3456e81345a1

    There are a few steps to setting this up.

    1. Setup a new app registration in Office365 to get a app Id and secret.
    2. Give that app the permissions needed to read and write the values you need.
    3. Use the ADAL npm package to obtain a token for the Graph API with those credentials.
    4. Make your calls to the Graph API, using the bearer token in the Authentication header
    5. Ensure your function.json file defines the trigger as a timer with a one day interval.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.