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
      .select(Fields.Email, Fields.HireDate, Fields.FullName)
      .then(listItems => {
        let rawData = new Array<any>();

        listItems.forEach((item: any) => {
          const hireDate = moment
          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],
            anniversaryDate: anniversaryDate.toDate()
        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


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


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

  • 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.