1

I've a custom webpart Anniversaries, which get data from list. Anniversaries webpart List with data for webpart

This is my service to get data from list:

public get(listName: string, startDate: Date, AnniversariesNumberOfItemsToDisplay: number): Promise<Person[]> {
    return sp.web.lists
      .getByTitle(listName)
      .select(Fields.Email, Fields.HireDate, Fields.FullName)
      .items.get()
      .then(listItems => {
        let rawData = new Array<any>();

        listItems.forEach((item: any) => {
          const hireDate = moment
            .utc(item[Fields.HireDate])
            .local()
            .toDate();
          let anniversaryDate = moment(hireDate).year(moment().year());
          if (anniversaryDate.isBefore(moment(), 'date')) {
            anniversaryDate = anniversaryDate.add(1, 'year');
          }

          const PersonItem = {
            email: item[Fields.Email],
            fullName: item[Fields.FullName],
            hireDate,
            anniversaryDate: anniversaryDate.toDate()
          };
          rawData.push(PersonItem);
        });
        return rawData;
      });
  }

But is it possible to take data for all users in Azure AD without using a list?

Data in Azure AD

2 Answers 2

0

Yes. It's possible to get users from Azure AD.

You can use PnPjs to do so where you can get users using @pnp/graph package. Below are some helpful links

1
0

That's really cool! Any plans to possibly make your app publicly available, surprising no one else has created anything specifically for anniversaries.

1
  • This is not an answer of the question. Rather this question can be asked by comment section Apr 18 at 3:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.