2013-03-28 55 views

回答

1

一個子文件夾中獲取的文件夾名稱你有任何示例代碼或者可以向我們展示迄今爲止嘗試過的代碼示例?

如果您可以提供更多信息或告訴我們更多關於您嘗試過的內容,甚至發佈您嘗試過的與特定問題有關的代碼,它將有助於回答您的問題。


然而,基於我認爲你是後我會嘗試,並提供響應....

有一點需要注意的是,list.RootFolder.SubFolder[i]實際上返回你的另一SPFolder對象。因此,您可以再次訪問SubFoldersproperty以獲取該子文件夾中的子文件夾。

這將是一個有點天真的例子,但類似:

SPFolder subFolder = list.RootFolder.SubFolder[i]; 
SPFolderCollection subFoldersOfSubFolder = subFolder.SubFolders; 

if (subFoldersOfSubFolder.Count > 0) 
{ 
    for (int j = 0; j < subFoldersOfSubFolder.Count; j++) 
    { 
     SPFolder specificSubFolder = subFoldersOfSubFolder[j]; 
     /* 
      At this point you could use properties like Name, 
      ServerRelativeUrl or UniqueId of the SubFolder class to get 
      the information you need. 
     */ 
    } 
} 
else 
{ 
    //If you get to here, it means that the sub-folder had no sub-folders 
} 
相關問題