Using MS Graph API to create a new folder by path

  Kiến thức lập trình

I am not sure if this is even possible but if I were to know the path of some premade folders such as “Online Archive/Inbox/TestParentFolder/” and I wanted to create a new folder inside TestParentFolder.How would I go about doing this with ms graph api in c#? Also not sure if its important but these subfolders/path are in the Online Archive as indicated in the path above but from my research that is handled similar to any other folder.

I am able to create folders in the main directory using the following:

        public async Task<Models.Folder> CreateArchiveFolderAsync(string mailbox, string stateAbbreviation, string folderName)
    {
        var requestBody = new MailFolder
        {
            DisplayName = folderName,
            IsHidden = false,
        };

        // To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
        var result = await _graphServiceClient!.Users[mailbox].MailFolders.PostAsync(requestBody);

        return new Models.Folder() {
            Id = result.Id
        };
    }

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website Kho Theme wordpress Kho Theme WP Theme WP

LEAVE A COMMENT