Patrick Lamber
Patrick Lamber Microsoft Office Development MVP

Retrieve the Known Folder Redirection Folder names from an OneDrive site using PowerShell

My colleagues planned the migration of customer content to OneDrive for Business. Parts of the organization was already using the Known folder redirection feature provided by the OneDrive client. They were required to copy some of the contents to the Documents folder created by the OneDrive client on the OneDrive site. After enabling this feature, you can rename the names of the folders without breaking the link between the client and the OneDrive site. Furthermore, the folder names change based on the default language settings of the user. A German user has different folder names as a user with the English language.

They asked me to verify how to retrieve the folder URLs generated by the OneDrive client from the OneDrive site. You can find this information in the root folder properties of the Documents library. These properties are populated once you enable the Known folder redirection in your client. You can find these property names:

  • vti_DesktopFolderGuid: is the GUID of the folder intended for the Desktop folder
  • vti_DocumentsFolderGuid: is the GUID of the folder intended for the Documents folder
  • vti_PhotosFolderGuid: is the GUID of the folder intended for the Photos folder
  • vti_CameraRollFolderGuid: is the GUID of the folder intended for the Camera Roll folder
  • vti_ScreenShotsFolderGuid: is the GUID of the folder intended for the Screenshots folder

First, you have to retrieve the GUID from the properties specified above. Afterward, you can obtain the item information of the desired folder in the Documents library by using that GUID.

I created a simple PowerShell script that retrieves these paths using PNP PowerShell. Please note that the user must have read rights to the OneDrive site in question to retrieve this information.

comments powered by Disqus