新しいBoxサポートサイトへようこそ。 変更点の詳細はこちらをご確認ください .

Box Content Preview use specific version

回答済み
新規投稿

コメント

10件のコメント

  • Kourtney

    Hello : 

     

    Thanks so much for using our platform and development forum! 

     

    Here's an example of how to accomplish this: 

     

    var preview = new Box.Preview();
    preview.show(FILE_ID, ACCESS_TOKEN, {
    container: '.preview-container',
    showDownload: true,
    fileOptions: {
    fileVersionId: '199928394633'
    }
    });

     

    There is documentation you can refer to here as well! 

    0
    コメントアクション パーマリンク
  • NickUK

    Thanks . Doesn't look like it would work for multiple files (carousel)?

    0
    コメントアクション パーマリンク
  • Kourtney

     are you looking for something like this

    0
    コメントアクション パーマリンク
  • jpress

    Hi NickUK, If you're referring to multiple files for one instance of preview, you can specify versions like so (1,2,3,4 are file IDs):

    Documentation can be found here: https://github.com/box/box-content-preview#parameters--options

     

    var preview = new Box.Preview();
    preview.show(FILE_ID, ACCESS_TOKEN, {
    container: '.preview-container',
    collection: ['1', '2', '3', '4'] showDownload: true, fileOptions: { '1': { fileVersionId: '12345' }, '2': { fileVersionId: '54321' }, '3': { fileVersionId: '32145' }, '4': { fileVersionId: '32145' } });

     

    0
    コメントアクション パーマリンク
  • dysp

    Does this work with the free developer's version of Box?

    0
    コメントアクション パーマリンク
  • jpress

    hi ,

    Yes, you are able to use the Preview SDK with a developer account. 

    0
    コメントアクション パーマリンク
  • Kourtney

    I believe it should work!  

    0
    コメントアクション パーマリンク
  • dysp
    this.preview.show(this.props.contentId, this.props.boxToken, {
    container: '.documentPreviewArea',
    header: 'none',
    fileOptions: {
    fileVersionId: this.state.currentVersionId
    }
    });
     
    I'm trying to show preview version using this code, but it keeps showing the current version of the document.
    Do I have to reinitialize the box client or the box preview? 
    0
    コメントアクション パーマリンク
  • jpress

    You shouldn't need to reinit preview, but you will need to map from file ID to file version ID, so we know which version you want to use for which file.

     

     

    I think in your example you would need to do the following:

    this.preview.show(this.props.contentId, this.props.boxToken, {
        container: '.documentPreviewArea',
        header: 'none',
        fileOptions: {
            this.props.contentId: {
                fileVersionId: this.state.currentVersionId
            }
        }
    });
    0
    コメントアクション パーマリンク
  • dysp

     Thank you it worked!

    0
    コメントアクション パーマリンク

サインインしてコメントを残してください。