Get child items under "My drive" item sample.
This commit is contained in:
		@@ -4,6 +4,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FarmmapsApiSamples", "Farmm
 | 
				
			|||||||
EndProject
 | 
					EndProject
 | 
				
			||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FarmmapsApi", "FarmmapsApi\FarmmapsApi.csproj", "{1FA9E50B-F45E-4534-953A-37C783D03C74}"
 | 
					Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FarmmapsApi", "FarmmapsApi\FarmmapsApi.csproj", "{1FA9E50B-F45E-4534-953A-37C783D03C74}"
 | 
				
			||||||
EndProject
 | 
					EndProject
 | 
				
			||||||
 | 
					Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "General", "General", "{6FA66E07-A59E-480E-B5D1-DBEFC4E4583D}"
 | 
				
			||||||
 | 
					ProjectSection(SolutionItems) = preProject
 | 
				
			||||||
 | 
						README.MD = README.MD
 | 
				
			||||||
 | 
						.gitignore = .gitignore
 | 
				
			||||||
 | 
					EndProjectSection
 | 
				
			||||||
 | 
					EndProject
 | 
				
			||||||
Global
 | 
					Global
 | 
				
			||||||
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 | 
						GlobalSection(SolutionConfigurationPlatforms) = preSolution
 | 
				
			||||||
		Debug|Any CPU = Debug|Any CPU
 | 
							Debug|Any CPU = Debug|Any CPU
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,5 @@
 | 
				
			|||||||
using System;
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
using System.Threading.Tasks;
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
using FarmmapsApi.Services;
 | 
					using FarmmapsApi.Services;
 | 
				
			||||||
using Microsoft.Extensions.Logging;
 | 
					using Microsoft.Extensions.Logging;
 | 
				
			||||||
@@ -27,11 +28,21 @@ namespace FarmmapsApiSamples
 | 
				
			|||||||
                var user = await _farmmapsApiService.GetCurrentUserCodeAsync();
 | 
					                var user = await _farmmapsApiService.GetCurrentUserCodeAsync();
 | 
				
			||||||
                _logger.LogInformation($"Usercode: {user}");
 | 
					                _logger.LogInformation($"Usercode: {user}");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                var roots = await _farmmapsApiService.GetCurrentUserRootsAsync();
 | 
					                var roots = (await _farmmapsApiService.GetCurrentUserRootsAsync()).ToList();
 | 
				
			||||||
                foreach (var userRoot in roots)
 | 
					                foreach (var userRoot in roots)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    _logger.LogInformation($"{userRoot.Name} - {userRoot.Code}");
 | 
					                    _logger.LogInformation($"{userRoot.Name} - {userRoot.Code}");
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                var myDriveRoot = roots.SingleOrDefault(r => r.Name == "My drive");
 | 
				
			||||||
 | 
					                if(myDriveRoot != null)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    var items = await _farmmapsApiService.GetItemChildrenAsync(myDriveRoot.Code);
 | 
				
			||||||
 | 
					                    foreach (var item in items)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        _logger.LogInformation($"{item.Name} - {item.ItemType}");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            catch (Exception ex)
 | 
					            catch (Exception ex)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user