Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 获取层次结构中的OneDrive文件夹_.net_Xamarin_Office365 - Fatal编程技术网

.net 获取层次结构中的OneDrive文件夹

.net 获取层次结构中的OneDrive文件夹,.net,xamarin,office365,.net,Xamarin,Office365,背景 我正在使用Microsoft.Office.365 0.1.1-alphabits从Xamarin应用程序(具体为iOS)访问OneDrive for Business 我现在的代码看起来像这样,用于检索文件夹列表 var client = await EnsureClientCreated(context); var fileResult = await client.Files.ExecuteAsync(); var folders = fileResult.CurrentPage.O

背景

我正在使用
Microsoft.Office.365 0.1.1-alpha
bits从Xamarin应用程序(具体为iOS)访问OneDrive for Business

我现在的代码看起来像这样,用于检索文件夹列表

var client = await EnsureClientCreated(context);
var fileResult = await client.Files.ExecuteAsync();
var folders = fileResult.CurrentPage.OfType<Microsoft.Office365.SharePoint.Folder>();
但是,
Childrens
集合包含0个子项,并且没有任何其他信息表明该子项位于根目录中或具有父项

同样值得注意的是,我的SharePoint经验非常有限!:)

问题


如何使用“Microsoft Office 365 My Files Library for.NET”访问OneDrive for business,以便浏览文件夹结构?

我不能100%确定您的问题是否正确

请试一试。这将为您提供“my.sharepoint.com/personal/someuser\u some\u domain\u com/Documents/Shared”的所有子文件夹的可枚举性

如果这对你不起作用,请告诉我

IPagedEnumerable<IFileSystemItem> filesResults = 
                                  await client.Files["Shared"].ToFolder().Children.ExecuteAsync();

//youmight loop through all child folders  
 foreach (IFileSystemItem file in filesResults.CurrentPage) 
 {
    // do something
 }
IPagedEnumerable文件结果=
等待client.Files[“Shared”].ToFolder().Children.ExecuteAsync();
//您可以遍历所有子文件夹
foreach(FileResults.CurrentPage中的IFileSystemItem文件)
{
//做点什么
}

菲利普

我要试试看!如果您想要根目录中的所有文件夹怎么办?
IPagedEnumerable<IFileSystemItem> filesResults = 
                                  await client.Files["Shared"].ToFolder().Children.ExecuteAsync();

//youmight loop through all child folders  
 foreach (IFileSystemItem file in filesResults.CurrentPage) 
 {
    // do something
 }