2016-08-17 58 views
0

我可以使用「fileUploadRequestToFolderWithID:BoxAPIFolderIDRoot」密鑰成功將文件上傳到文件存儲根目錄,但我想將文件上傳到我創建的特定文件夾:使用Box api將文件上傳到特定文件夾Objective-c iOS

BOXContentClient *contentClient = [BOXContentClient defaultClient]; 
BOXFolderCreateRequest *folderCreateRequest = [contentClient folderCreateRequestWithName:@"New Folder" parentFolderID:BoxAPIFolderIDRoot]; 
[folderCreateRequest performRequestWithCompletion:^(BOXFolder *folder, NSError *error) { 
    // If successful, folder will be non-nil and represent the newly created folder on Box; otherwise, error will be non-nil. 
}]; 

如何檢索上傳文件的文件夾ID?

在此先感謝!

回答

1

Box iOS SDK引用文件夾的ID作爲文件夾的modelID。您可以訪問folderCreateRequest的完成塊內的文件夾的modelID屬性。例如:

BOXContentClient *contentClient = [BOXContentClient defaultClient]; 
BOXFolderCreateRequest *folderCreateRequest = [contentClient folderCreateRequestWithName:@"New Folder" parentFolderID:BoxAPIFolderIDRoot]; 
[folderCreateRequest performRequestWithCompletion:^(BOXFolder *folder, NSError *error) { 
NSString *folderID = folder.modelID; 
}]; 
相關問題