Example #1
0
        public static async Task <string> CopyMailFolderAsync(string folderId, string ToFolderName)
        {
            try
            {
                OutlookServicesClient outlookClient = await GetOutlookClientAsync();

                IFolder folderToCopy = await outlookClient.Me.Folders.GetById(folderId).ExecuteAsync();

                IFolder copiedFolder = await folderToCopy.CopyAsync(ToFolderName);

                Debug.WriteLine("Copied folder: " + folderId + " to " + ToFolderName);

                return(copiedFolder.Id);
            }
            catch (ODataErrorException ex)
            {
                // GetById will throw an ODataErrorException when the
                // item with the specified Id can't be found in the contact store on the server.
                Debug.WriteLine(ex.Message);
                return(null);
            }
        }