Share via

Get folder id from folder name using Graph client SDK in C#

SAC_535 36 Reputation points
2022-05-17T10:48:49.693+00:00

How to get folder id from folder name (Custom folders eg. Testfolder ) in Microsoft graph client using C#

Microsoft Security | Microsoft Graph

2 answers

Sort by: Most helpful
  1. CarlZhao-MSFT 46,456 Reputation points
    2022-05-18T08:45:48.197+00:00

    Hi @SAC_535

    Try this code snippet:

    await graphClient.Me.MailFolders  
        .Request()  
        .Filter("displayName eq '{mailfolder name}'")  
        .GetAsync();  
    

    203088-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?

    1 person found this answer helpful.

  2. CarlZhao-MSFT 46,456 Reputation points
    2022-05-18T02:24:02.273+00:00

    Hi @SAC_535

    Refer to my code snippet:

    await graphClient.Me.Drive.Root.ItemWithPath("/{folder name}").Request().GetAsync();  
    

    202907-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


Your answer

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