开发者

Get a Collection/Folder by name in google DOCS API

开发者 https://www.devze.com 2023-04-01 21:39 出处:网络
I\'m trying to get a collection/Folder by it name but am getting an error, this what i got: DocsService client = new DocsService(\"test testnet v1\");

I'm trying to get a collection/Folder by it name but am getting an error, this what i got:

DocsService client = new DocsService("test testnet v1");
     //Get the ur to access google docs folders
     URL feedUrl=new URL("https://docs.google.com/feeds/default/private/full/folder%3Aroot?oauth_token="+token);

    开发者_Go百科 DocumentQuery query = new DocumentQuery(feedUrl);
     query.setTitleQuery(name);
     query.setTitleExact(true);
     DocumentListFeed feed=null;

    try {
        feed = client.getFeed(query, DocumentListFeed.class);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ServiceException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    //Get the entry founded

     for (DocumentListEntry entry : feed.getEntries()) {
            resourceId = entry.getDocId();
    }

Hope some one can help me, Thx.


using url https://docs.google.com/feeds/default/private/full/-/folder will list the folders (or you can do a search query by name). From that list, you can find your folder by name and then do a query by resource id using https://docs.google.com/feeds/default/private/full/[resource id]/contents

I don't think there is an easier way.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号