How to Create Folder/ Sub Folder from Servicenow to Share Point

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 03:02 AM
Client has a share point and wanted to create folder when case is updated with RITM number. Is there any possibility to create folder from servicenow system to share point on Updation of case in servicenow.
Any help would be appreciated.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 07:40 AM
Hi @SaiRaviKiran Ak ,
Hope you are doing great.
Here's a high-level solution for your scenario:
Establish a connection between ServiceNow and SharePoint using the SharePoint REST API or SharePoint Connector in ServiceNow. This connection allows ServiceNow to interact with SharePoint.
Define a business rule or script in ServiceNow that triggers when a case is updated. This rule should extract the RITM number associated with the case.
Utilize the SharePoint integration within ServiceNow to invoke the SharePoint REST API and create a folder in the desired SharePoint location. You can specify the folder name as the RITM number obtained from the case update.
Below is snippet which you can reference:
// Assuming 'ritmNumber' contains the extracted RITM number
var folderName = ritmNumber;
// Use the SharePoint REST API endpoint to create the folder
var sharepointURL = "https://your-sharepoint-site.com/api/createfolder";
var requestBody = {
folderName: folderName,
location: "/path/to/sharepoint/folder"
};
// Make an HTTP request to create the folder in SharePoint
var response = gs.restPost(sharepointURL, requestBody);
// Check the response status to ensure the folder creation was successful
if (response && response.statusCode == 201) {
gs.info("Folder created in SharePoint: " + folderName);
} else {
gs.error("Failed to create folder in SharePoint. Please check the integration configuration.");
}
Regards,
Riya Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2024 02:01 AM
Hi Riya, @Riya Verma
Is there a way to also populate metadata while creating a SharePoint folder from ServiceNow via integration?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2025 05:46 AM
test