How to get image embed webURL using the createLink end point for business onedrive

Yasser Malik 0 Reputation points
2023-01-30T18:31:14.85+00:00

I wanted to use onedrive images as a src for my <img> tags to show on my website using our business onedrive.

I know that the embed option is not available when using the createLink end point for business onedrives. Would there be any other solution? Using the below will generate a one drive viewer rather than the url of the image

        DriveItemCreateLinkParameterSet params = new DriveItemCreateLinkParameterSet();
						                    params.scope = "anonymous";
						                    params.type = "view";
						                   Permission permission =  client.drive().items(fourthLevelItem.id).createLink(params).buildRequest().post();
						                   String url = permission.link.webUrl;
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,799 questions
OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
857 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,574 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. JIAN WANG 335 Reputation points
    2023-01-30T18:58:23.08+00:00

    you may wan to combine sharepoint, then you have quite many options.

    for example develop the code invoke sharepoint image; use powerautomate..etc.


  2. Emily Hua-MSFT 27,551 Reputation points
    2023-01-31T06:38:16.44+00:00

    Hi @Yasser Malik

    As your issue is related to OneDrive developer, I also suggest you post a new thread on Microsoft Tech Community --- OneDrive Developers.

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    0 comments No comments