Find the original name of a folder

Glenn Skinner 1 Reputation point
2022-09-16T16:17:48.5+00:00

We have a Sharepoint site where users create folders and they are named specifically a number that relates to documentation that will be stored in it. We now have a problem where by a user wants to create a folder and call it i.e. Example12345 but when they do they get an error to say folder already exists. This is because we set a script to ensure we cant have duplicate names.

But is their a ps script or something that can be run to return the original folder name at the point of folder creation and the current name. As what i believe is happened is a folder has already been created with the name and then changed for some reason.

Microsoft 365 and Office | Development | Office JavaScript API
Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft 365 and Office | SharePoint Server | Development
Windows for business | Windows Server | User experience | PowerShell
{count} votes

3 answers

Sort by: Most helpful
  1. SChalakov 10,576 Reputation points MVP Volunteer Moderator
    2022-09-20T08:45:38.617+00:00

    Hi @Glenn Skinner ,

    not quite sure how this looks in SharePoint, but when it comes to Windows folders, I think you need some file creation auditing tool like Sysinternal's Sysmon:

    Sysmon v14.0
    https://learn.microsoft.com/en-us/sysinternals/downloads/sysmon

    I would personally prefer enabling a simple auditing policy like this and reading the auduit logs with PowerShell afterwards:

    Apply a basic audit policy on a file or folder
    https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/apply-a-basic-audit-policy-on-a-file-or-folder

    Parsing the Admin Audit Logs with PowerShell (Example for Admin Audit Logs)
    https://techcommunity.microsoft.com/t5/exchange-team-blog/parsing-the-admin-audit-logs-with-powershell/ba-p/603911

    Hope this helps you out!

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
    Regards
    Stoyan Chalakov

    0 comments No comments

  2. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2022-09-20T09:16:19.543+00:00

    Hi @Glenn Skinner
    As far as I know, there is no such way to get the original name afer rename it. The original folder name is lost after rename. For file types, we can view history versions. But even I try to restore the original version, the file name is still the name after rename.
    242889-image.png

    Per my research, I feel regretful to inform you that it turns out to be a by-design one. I noticed that some end users have also proposed the same request, it is highly recommended that you can vote this ticket. Many features of our current products are designed and upgraded based on customers’ feedback. With requirements like this increase, the problem may well be released in the future. Thanks for your understanding.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    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.



  3. Glenn Skinner 1 Reputation point
    2022-10-17T16:11:33.313+00:00

    This is not resolved we so far haven't found a way to do this and I don't think we will be able to. I think we may go back to the customer and advise accordingly

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.