Generate Temporary Download URLs in Dynamics 365 CRM Using GetFileSasUrl Function

By | January 13, 2026

GetFileSasUrl

Organizations use Dynamics 365 CRM (Dataverse) to store important documents, contracts, invoices, identity proofs, approval letters, and even email attachments. Everything is neatly stored inside CRM as File columns, Notes, or Email attachments.

Now comes a simple request: “Can you send this document to the customer?”

Sounds easy, right? But as soon as you try, reality hits.

  • The customer is not a CRM user
  • They cannot authenticate to Dataverse
  • Direct file download APIs require authentication
  • Emailing large attachments is restricted, insecure, and inefficient

What looked like a small request suddenly turns into a design challenge. This is exactly where GetFileSasUrl becomes a game-changer.

The Core Challenge: Sharing Files Outside CRM

Dynamics 365 and Dataverse are designed with strong security boundaries. Files stored inside CRM are protected, and for good reason.

However, this also means:

  • External users cannot directly download files
  • API-based file downloads work only for authenticated users
  • Partners, vendors, customers, or contractors are locked out
  • Developers often end up:
    • Copying files to SharePoint
    • Building custom APIs
    • Emailing attachments manually
    • Or using unsafe workarounds

All of these add complexity, security risk, and maintenance overhead.

What teams really need is: “A secure way to share a file temporarily, without forcing login.”

GetFileSasUrl: A Simple but Powerful Solution

Microsoft Dataverse solves this exact problem with the GetFileSasUrl Function. Instead of exposing the file itself, Dataverse generates a temporary, secure download link—also known as a SAS URL (Shared Access Signature URL).

This URL:

  • Works without authentication
  • Is time-bound (typically valid for 1 hour)
  • Automatically expires
  • Gives read-only access to the file

Most importantly, it works for files stored in:

  • File columns
  • Image columns
  • Note (annotation) attachments
  • Email attachments

No SharePoint.
No custom APIs.
No security compromises.

Why GetFileSasUrl Makes So Much Sense

Before using GetFileSasUrl, teams usually struggle with:

  • External users blocked by authentication
  • Email size limits for attachments
  • Sensitive documents floating in inboxes
  • Manual effort from sales or support teams

GetFileSasUrl solves all of this by providing:

  • Anonymous access (no login required)
  • Automatic expiry (security by design)
  • Direct download experience
  • Minimal development effort

Think of it as “secure file sharing, CRM-native style.”

Example 1: Generating SAS URL for a File Column

var target = new EntityReference("account", accountId);
var request = new GetFileSasUrlRequest()

{

Target = target,

FileAttributeName = "new_file"

};

var response = (GetFileSasUrlResponse)service.Execute(request);

// Access response

var fileResponse = response.Result;

Console.WriteLine("SAS URL: " + fileResponse.SasUrl);

Example 2: Generating SAS URL for a Note Attachment

var target = new EntityReference("annotation", annotationId);

var request = new GetFileSasUrlRequest()

{

Target = target,

FileAttributeName = string.Empty

};

var response = (GetFileSasUrlResponse)service.Execute(request);

// Extract SAS URL

Console.WriteLine(response.Result.SasUrl);

Example 3: Generating SAS URL for an Email Attachment

var target = new EntityReference("activitymimeattachment", attachmentId);

var request = new GetFileSasUrlRequest()

{

Target = target,

FileAttributeName = string.Empty

};

var response = (GetFileSasUrlResponse)service.Execute(request);

Console.WriteLine(response.Result.SasUrl);

Frequently Asked Questions (FAQs)

What is GetFileSasUrl in Dynamics 365 Dataverse?

GetFileSasUrl is a Dataverse function that generates a temporary, secure download link (SAS URL) for files stored in Dynamics 365 CRM. The link allows external users to download files without authentication and automatically expires after a defined time.

What is a SAS URL in Dynamics 365?

A SAS URL (Shared Access Signature URL) is a time-limited, read-only access link generated by Dataverse. It provides secure access to CRM files such as file columns, note attachments, and email attachments without exposing the actual storage or requiring user login.

How long is a GetFileSasUrl link valid?

By default, a GetFileSasUrl-generated link is valid for approximately one hour. After expiration, the URL becomes invalid and cannot be reused, ensuring strong security.

Can external users download CRM files using GetFileSasUrl?

Yes. External users do not need a Dynamics 365 or Dataverse account. Anyone with the SAS URL can download the file until the link expires.

Which file types are supported by GetFileSasUrl?

GetFileSasUrl supports:

        • File columns
        • Image columns
        • Note (annotation) attachments
        • Email (activitymimeattachment) attachments

This makes it suitable for sharing contracts, invoices, identity documents, and email files.

Wrapping Up

The GetFileSasUrl Function is one of those hidden gems in Dataverse that solves a real-world problem elegantly. It gives you:

        • Temporary public download links
        • Zero authentication requirements
        • Automatic expiry for security
        • Full support for file columns, notes, and email attachments
        • Clean integration with modern CRM solutions

If your Dynamics 365 solution ever needs to share files outside CRM, this should be your first choice.


											
Category: Dynamics 365 Technical Uncategorized

About Sam Kumar

Sam Kumar is the Vice President of Marketing at Inogic, a Microsoft Gold ISV Partner renowned for its innovative apps for Dynamics 365 CRM and Power Apps. With a rich history in Dynamics 365 and Power Platform development, Sam leads a team of certified CRM developers dedicated to pioneering cutting-edge technologies with Copilot and Azure AI the latest additions. Passionate about transforming the CRM industry, Sam’s insights and leadership drive Inogic’s mission to change the “Dynamics” of CRM.