BookmarkSubscribeRSS Feed

SAS Viya Integration with SharePoint (Microsoft 365) Using Custom Steps: A No-Code/Low-Code Approach

Started 6 hours ago by
Modified yesterday by
Views 62

In today’s cloud landscape, enterprises depend on SAS Viya for powerful analytics and Microsoft SharePoint for secure content management and team collaboration. However, moving files between these platforms has traditionally been a painful, manual process. This article introduces a no-code/low-code solution using custom steps in SAS Studio that automates file uploads, downloads, listings, and content management by eliminating manual intervention and reducing errors.

 

You can remove the friction of manual file transfers by seamlessly integrating SAS Viya with Microsoft SharePoint site through powerful, user-friendly custom steps in SAS Studio.

 

Spoiler

You can download the full toolkit of SAS Viya custom steps featured in this article from the attachments.

 

The Problem: Manual File Transfers Between SAS Viya and SharePoint

 

Analytics teams frequently struggle with the same repetitive and inefficient tasks when working across platforms:

 

  • Manually downloading flat files (such as CSVs) from SharePoint into SAS Viya for analysis
  • Uploading analytical results, reports, and processed datasets back to SharePoint for business stakeholders
  • Struggling to maintain proper governance, version control, and audit trails across the systems

 

For years, teams had only two but limited options:

 

  1. Manual file handling: Copying and pasting files through the SharePoint web interface or File Explorer. This approach is slow, highly error-prone, not scalable, and impossible to audit effectively.
  2. Custom-coded solutions: Writing complex scripts using OAuth2, Microsoft Graph API, and SAS programming. While functional, this requires advanced coding skills, is difficult to maintain, and creates dependency on technical experts.

 

These challenges result in manual bottlenecks, weakened governance, technical barriers, and persistent silos between analytics and business teams.

 

The Solution: SAS Custom Steps for SharePoint

 

We developed a set of secure, standardized, reusable custom steps for SAS Studio that wrap Microsoft Graph API complexity into simple point-and-click interfaces.

 

Key Benefits:

 

  • Automated Data Flows: Direct API connection between SharePoint site and SAS Viya
  • Centralized Security: Leverages Azure AD OAuth2 with proper governance and logging
  • No-Code Interfaces: Business users and analysts can operate via visual forms
  • Standardized Workflows: Consistent, repeatable file operations
  • Full Auditability: All actions are logged within SAS

 

How It Works: High-Level Process

 

MayurJadhav_1-1780433777931.png

 

The integration uses the Microsoft Graph API with OAuth 2.0 authentication.

The process involves three main phases:

 

  1. One-Time Setup
    • Register a Client Application in Azure portal (via portal.azure.com)
    • Configure permissions for SharePoint site access
    • Obtain Tenant ID and Client ID
  2. Authentication Flow
    • Obtain Authorization Code (one-time per user)
    • Generate Access Token
    • Refresh Token as needed (tokens expire after ~60 minutes)
  3. File Operations
    • Import files from SharePoint site → SAS Viya
    • Export files from SAS Viya → SharePoint site

 

Execution Flow

 

The integration follows a simple and secure step-by-step process:

  1. The user configures all necessary parameters through the intuitive SAS Studio Custom Step UI.
  2. SAS Viya automatically builds and sends secure Microsoft Graph API requests using the provided credentials.
  3. Azure AD validates the OAuth 2.0 access token and authorizes the operation.
  4. The requested file operations (Read, Write, Import, or Export) are executed directly on the SharePoint site.
  5. Operational results, status messages, and detailed logs are returned to the SAS Studio interface for review.

 

One-Time Setup: Register a Client App in Azure Portal 

 

Before you can connect SAS Viya to SharePoint, you need to register a client application in Microsoft Azure portal. This is a one-time activity typically performed by your organization’s IT or DevOps team.

 

MayurJadhav_2-1780434366074.png

Steps to Register:

 

  1. Go to the Azure portal (portal.azure.com).
  2. Register the app for your specific SharePoint site.
  3. Grant the necessary API permissions (Microsoft Graph) such as:
    • Files.ReadWrite.All
    • Sites.ReadWrite.All
    • User.Read (if required)
  4. Note down the Tenant ID and Client ID generated after registration.

 

 

 

SharePoint config file template:

{
  "tenant_id": "your-tenant-id-here",
  "client_id": "your-client-id-here",
  "redirect_uri": "https://login.microsoftonline.com/common/oauth2/nativeclient",
  "resource": "https://graph.microsoft.com"
}

 

 

The Toolkit: SharePoint Custom Steps

 

1. Generate Access Token Step

 

 
MayurJadhav_4-1780435654089.png

 

This step submits a POST request to the Microsoft identity platform to retrieve a short-lived OAuth 2.0 bearer token.

 

Key Features:

  • Build authorization URL manually to obtain authorization code. Check out this article for step by step process to get an authorization code. 
    • Authorization URL:

      https://login.microsoftonline.com/{tenant_id}/oauth2/authorize?client_id={client_id}

      &response_type=code&redirect_uri={redirect_uri}&resource={resource}

  • Use this custom step to generate and store token file into secured location

Required Inputs (from config file):

  • Tenant ID
  • Client ID
  • Redirect URI
  • Resource
  • Authorization Code
  • Token file name and storage location

 

Note: Access tokens expire in approximately 60 minutes. Use the Refresh custom step to refresh access token.

PS- Client secrets are intentionally excluded; token-based authentication is enforced for tighter security.

 

2. Refresh Access Token Step

 

This custom step automatically renews an expiring access token using a valid refresh token.

 

Required Inputs:MayurJadhav_5-1780435730331.png

  • Tenant ID
  • Client ID
  • Redirect URI
  • Location of stored token file

This ensures uninterrupted execution in scheduled or long-running flows.

 

3. SharePoint Import & Export Step

 

Action: Import

Action: Export
MayurJadhav_6-1780435943799.png

 

MayurJadhav_8-1780436022324.png

 


 

 

The core step that performs actual file operations using the active bearer token.

Import Action (SharePoint site → SAS Viya)

  • Downloads file from SharePoint document library
  • Transfer files into SAS Viya
  • Supports various file formats (CSV, Excel, etc.)

Required Parameters:

  • Token file
  • Action: Import
  • SharePoint Hostname / Site Path
  • Drive Name
  • Folder Path
  • File Name
  • Output location in SAS Viya

Export Action (SAS Viya → SharePoint site)

  • Uploads any file, or report output to SharePoint site
  • Maintains folder structure and versioning

Required Parameters:

  • Token file
  • Action: Export
  • SharePoint Hostname / Site Path
  • Drive Name
  • Folder Path
  • Source File in SAS Viya

 

End-to-End Workflow 

 

MayurJadhav_9-1780436213252.png

 

 

Setting Up the Environment:

 

  1. Register Client App in Azure Portal (one-time)
  2. Create SharePoint Config File (JSON) with Tenant ID, Client ID, etc.
  3. Add custom steps to your SAS Studio environment

 

Typical Pipeline: Generate Access Token → Refresh Access Token → SharePoint Import → Analytics → SharePoint Export

You can schedule the entire flow using SAS Viya Jobs or Apache Airflow for fully automated data pipelines.

 

Business Impact

 

  • Time Savings: Eliminate hours of manual file handling
  • Improved Governance: All movements are logged and secured via Azure AD
  • Enhanced Collaboration: Business users get fresh data in SharePoint site
  • Reduced Errors: Standardized, validated operations
  • Scalability: Works across multiple sites and libraries

 

This solution effectively bridges the gap between powerful analytics platforms and enterprise collaboration tools. By bringing no-code integration capabilities directly into SAS Studio, we empower both technical and business users to focus on insights rather than file management.

 

Download the Custom Steps

 

The complete toolkit (includes all three custom steps) is attached with this article and available for download.

Files included:

  • SharePoint Config file template (.json)
  • Generate Access Token.step
  • Refresh Access Token.step
  • SharePoint ImportExport.step

 

Source: The code implemented within these presented custom steps is derived from, and inspired by, this referenced article. https://blogs.sas.com/content/sasdummy/2026/02/02/sas-programming-office-365-onedrive/

 

References:

 

For any questions, please don't hesitate to contact me on LinkedIn.

 

 

Contributors
Version history
Last update:
yesterday
Updated by:

Viya Copilot Motion Graphic.gif

Ready to see what SAS Viya Copilot can do?

Visit the Tips & Tricks page for setup guidance, demos, and practical examples that show how Copilot supports your workflows.

Get Started →

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started

Article Tags