Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

getSharedLink is returning garbage

Répondu
Nouvelle publication

Commentaires

3 commentaires

  • mwiller

     Hey, I'm Matt and my team maintains the Box Java SDK — I'm happy to help you out here!  The output you're seeing isn't garbage, it's just Java telling you that what you're dealing with is an Object of some sort that doesn't have an overridden .toString() method (specifically one with type com.box.sdk.BoxSharedLink).  If you look at the Javadocs for the getSharedLink() method, you'll see that it returns this type of object, not a String.  To get the actual URL string, you'll need to something like this:

     

    BoxSharedLink sharedLink = itemInfo.getSharedLink();
    if (sharedLink != null) {
        String sharedLinkURL = sharedLink.getURL();
        // do something with the shared link URL
    }
    0
    Actions pour les commentaires Permalien
  • LandC

    Matt,

     

    Thank you for your prompt response.  My apologies for such a simple oversight.  I used your code below and it worked like a charm!

     

    LandC

    0
    Actions pour les commentaires Permalien
  • mwiller

    No problem — glad you got it working!

    0
    Actions pour les commentaires Permalien

Vous devez vous connecter pour laisser un commentaire.