Forum Discussion
Document Sets - Default Content
- May 23, 2024
In SharePoint Online, while there is no direct out-of-the-box setting to automatically rename the default content when adding it to a Document Set, so far i know .
But you can maybe try to achieve this using Power Automate.
Im not sure, if this works. Here a try:
Step-by-Step Solution:
- Set Up Document Set with Default Content:
- Ensure you have your Document Set content type configured and the default content added (e.g., Letter Template).
- Create a Power Automate Flow:
- Trigger: Use the "When a file is created or modified (properties only)" trigger from SharePoint.
- Condition: Check if the file is inside the desired Document Set and if the file name matches document.docx.
- Action: Rename the file to the desired template name.
Detailed Steps to Create the Flow:
- Go to Power Automate:
- Navigate to Power Automate.
- Create a New Flow:
- Click on "Create" and select "Automated flow".
- Set the Trigger:
- Choose "When a file is created or modified (properties only)".
- Set the Site Address and Library Name to point to your SharePoint Document Library.
- Add a Condition:
- Click on "New step" and add a "Condition".
- Set the condition to check if the file name is document.docx.
- In the "Choose a value" box, select the "File name with extension" dynamic content.
- Choose "is equal to" as the operator.
- Enter document.docx in the value box.
- Add Actions for the Condition:
- If the condition is true (i.e., the file name is document.docx):
- Add a "Send an HTTP request to SharePoint" action.
- Configure it to rename the file.
- Site Address: Your SharePoint site address.
- Method: POST.
- URI: _api/web/GetFileByServerRelativeUrl('<library-relative-url>/document.docx')/moveto(newurl='<library-relative-url>/LetterTemplate.docx',flags=1).
- Headers:
- Key: Accept
- Value: application/json;odata=verbose
- Save and Test the Flow:
- Save your flow and test it by creating a new document in the Document Set.
- The flow should trigger and rename the document.docx file to LetterTemplate.docx.
Example Power Automate Flow Configuration:
Trigger: When a file is created or modified (properties only)
- Site Address: Your SharePoint site URL.
- Library Name: Your document library name.
Condition:
- Condition: File name with extension is equal to document.docx.
If Yes:
- Action: Send an HTTP request to SharePoint
- Site Address: Your SharePoint site URL.
- Method: POST
- URI: _api/web/GetFileByServerRelativeUrl('/sites/yoursite/Shared Documents/document.docx')/moveto(newurl='/sites/yoursite/Shared Documents/LetterTemplate.docx',flags=1)
- Headers:
- Accept: application/json;odata=verbose
Notes:
- Make sure to replace placeholders like <library-relative-url>, yoursite, Shared Documents, etc., with actual values from your SharePoint setup.
- Ensure you have proper permissions to use the "Send an HTTP request to SharePoint" action, as it requires elevated permissions.
By setting up this flow, you can automate the renaming process, making it easier for users to manage and identify documents within the Document Set. The text and the steps were created with the help of AI.
My answers are voluntary and without guarantee!
Hope this will help you.
Was the answer useful? Mark as best response and like it!
This will help all forum participants.
In SharePoint Online, while there is no direct out-of-the-box setting to automatically rename the default content when adding it to a Document Set, so far i know .
But you can maybe try to achieve this using Power Automate.
Im not sure, if this works. Here a try:
Step-by-Step Solution:
- Set Up Document Set with Default Content:
- Ensure you have your Document Set content type configured and the default content added (e.g., Letter Template).
- Create a Power Automate Flow:
- Trigger: Use the "When a file is created or modified (properties only)" trigger from SharePoint.
- Condition: Check if the file is inside the desired Document Set and if the file name matches document.docx.
- Action: Rename the file to the desired template name.
Detailed Steps to Create the Flow:
- Go to Power Automate:
- Navigate to Power Automate.
- Create a New Flow:
- Click on "Create" and select "Automated flow".
- Set the Trigger:
- Choose "When a file is created or modified (properties only)".
- Set the Site Address and Library Name to point to your SharePoint Document Library.
- Add a Condition:
- Click on "New step" and add a "Condition".
- Set the condition to check if the file name is document.docx.
- In the "Choose a value" box, select the "File name with extension" dynamic content.
- Choose "is equal to" as the operator.
- Enter document.docx in the value box.
- Add Actions for the Condition:
- If the condition is true (i.e., the file name is document.docx):
- Add a "Send an HTTP request to SharePoint" action.
- Configure it to rename the file.
- Site Address: Your SharePoint site address.
- Method: POST.
- URI: _api/web/GetFileByServerRelativeUrl('<library-relative-url>/document.docx')/moveto(newurl='<library-relative-url>/LetterTemplate.docx',flags=1).
- Headers:
- Key: Accept
- Value: application/json;odata=verbose
- Save and Test the Flow:
- Save your flow and test it by creating a new document in the Document Set.
- The flow should trigger and rename the document.docx file to LetterTemplate.docx.
Example Power Automate Flow Configuration:
Trigger: When a file is created or modified (properties only)
- Site Address: Your SharePoint site URL.
- Library Name: Your document library name.
Condition:
- Condition: File name with extension is equal to document.docx.
If Yes:
- Action: Send an HTTP request to SharePoint
- Site Address: Your SharePoint site URL.
- Method: POST
- URI: _api/web/GetFileByServerRelativeUrl('/sites/yoursite/Shared Documents/document.docx')/moveto(newurl='/sites/yoursite/Shared Documents/LetterTemplate.docx',flags=1)
- Headers:
- Accept: application/json;odata=verbose
Notes:
- Make sure to replace placeholders like <library-relative-url>, yoursite, Shared Documents, etc., with actual values from your SharePoint setup.
- Ensure you have proper permissions to use the "Send an HTTP request to SharePoint" action, as it requires elevated permissions.
By setting up this flow, you can automate the renaming process, making it easier for users to manage and identify documents within the Document Set. The text and the steps were created with the help of AI.
My answers are voluntary and without guarantee!
Hope this will help you.
Was the answer useful? Mark as best response and like it!
This will help all forum participants.