How to apply filter on sent items in Graph API

This is my code file where i am trying to add filters on inbox and sent items using microsoft graph api:

const GraphApiTest = ({ email }) => {
  const emailsPerPage = 5;
  const [inboxPage, setInboxPage] = useState(1);
  const [sentPage, setSentPage] = useState(1);
  const [inboxEmails, setInboxEmails] = useState([]);
  const [selectedEmail, setSelectedEmail] = useState(null);
  const [sentEmails, setSentEmails] = useState([]);
  const [loading, setLoading] = useState("");
  const [emailsData, setEmailsData] = useState({});
  const msalInstance = new PublicClientApplication(msalConfig);
  const users = [
    "[email protected]",
    "[email protected]",
    "[email protected]",
  ]; // Add the user emails here
  useEffect(() => {
    if (email) {
      loginAndFetchEmails();
    }
  }, [email]);
  const loginAndFetchEmails = async () => {
    try {
      await msalInstance.initialize();
      const accounts = msalInstance.getAllAccounts();
      if (accounts.length === 0) {
        await msalInstance.loginPopup({
          scopes: ["Mail.Read", "Mail.Send", "User.Read"],
        });
      }
      const account = msalInstance.getAllAccounts()[0];
      let tokenResponse;
      try {
        tokenResponse = await msalInstance.acquireTokenSilent({
          account,
          scopes: ["Mail.Read", "Mail.Send", "User.Read"],
        });
      } catch (silentError) {
        console.warn("Silent token acquisition failed, fallback to popup.");
        tokenResponse = await msalInstance.acquireTokenPopup({
          account,
          scopes: ["Mail.Read", "Mail.Send", "User.Read"],
        });
      }
      const accessToken = tokenResponse.accessToken;
      setLoading(true);
      // Fetch received emails (Inbox)
      const fetchedEmails = {};
      for (const user of users) {
        const inboxResponse = await axios.get(
         `https://graph.microsoft.com/v1.0/users/${user}/mailFolders('inbox')/messages?$filter=from/emailAddress/address eq '${email}'`,
        {
          headers: {
            Authorization: `Bearer ${accessToken}`,
          },
        }
        );
      // Fetch sent emails
      const sentResponse = await axios.get(
        `https://graph.microsoft.com/v1.0/users/${user}/mailFolders('sentitems')/messages`,
        {
          headers: {
            Authorization: `Bearer ${accessToken}`,
          },
        }
      );
      fetchedEmails[user] = {
        inbox: inboxResponse.data.value,
        sent: sentResponse.data.value,
      };
    }
    // Update state with emails for all users
    setEmailsData(fetchedEmails);
    } catch (error) {
      console.error("Error during login or fetching emails:", error);
    } finally{
      setLoading(false);
    }
  };
  const paginateEmails = (emails, page) => {
    const start = (page - 1) * emailsPerPage;
    const end = start + emailsPerPage;
    return emails.slice(start, end);
  };
  const inboxEmailsPaginated = paginateEmails(inboxEmails, inboxPage);
  const sentEmailsPaginated = paginateEmails(sentEmails, sentPage);
  const totalInboxPages = Math.ceil(inboxEmails.length / emailsPerPage);
  const totalSentPages = Math.ceil(sentEmails.length / emailsPerPage);
  const openModal = (email) => {
    setSelectedEmail(email);
  };
  const closeModal = () => {
    setSelectedEmail(null);
  };
  
export default GraphApiTest;

In this code when i am adding filter on inbox folders its working fine and giving me the filtered emails from that email address but for sent items when i try this :

const sentResponse = await axios.get(
  `https://graph.microsoft.com/v1.0/users/${user}/mailFolders/sentitems/messages?$filter=toRecipients/any(t:t/emailAddress/address eq '${email}')`,
  {
    headers: {
      Authorization: `Bearer ${accessToken}`,
    },
  }
);

It gives the error 400 and says invalid uri,, How can i add a filter on sent items folder too?? I have tried many ways but whenever i add a filter on sent items it always gives error while for inbox it works fine.

Recognized by Microsoft Azure Collective

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật