Best way to generate shareable URL from on prem Windows application's generated file

Cory Calavan 21 Reputation points

Hey All,

I am a systems guy who recently migrated to O365/Azure infrastructure. I have a team that develops a .NET Windows application and am trying to figure out the best path for creating an externally shareable URL from a file generated by the app. The app is used by customers which during a process generates a PDF and need to call an API to pass the downloadable URL for that PDF. I poked around graph and the documentation is really difficult to find a clear path to accomplish this and keep running into access denied issues even when I use my global admin account. I need to stay away from any user authentication and don't really need historical record of the files persisted, just to create a URL that can be shared to the next API call.

Any suggestions?

Microsoft Graph SDK
Microsoft Graph SDK
A Microsoft software developer kit designed to simplify building high-quality, efficient, and resilient applications that access Microsoft Graph.
891 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
1,989 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Michael 17,931 Reputation points

    Hi @Cory Calavan ,

    You could use MS Graph Create a sharing link for a DriveItem to create an externally shareable URLfor a file:

    For example POST /sites/{siteId}/drive/items/{itemId}/createLink

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    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

  2. Cory Calavan 21 Reputation points


    Thanks for the reply. I figured this would be the end result but I'm struggling getting the application auth to work for writing the file to sharepoint. I assume that is the first step right? Persist the file to SharePoint then use this to generate the shareable link? I think the issue is up until now we've used a token that is delegated and tied to a user. For this i'm trying to use an Application token and I am having issues getting that into the code and authenticated - keep getting Access Denied for the write. I can get info on the SP site but can't write the file. I tried throwing every SP/MS Graph permission to it as I could. Any suggestions?