SystemDataPaths In UWP (Windows 10 Fall Creators Update Features)

This SystemDataPaths, UserDataPaths, AppDataPaths class will be supported on Windows 10 Fall creators updated version build or greater and Windows 10 SDK 16999.

SystemDataPaths

SystemDataPaths class is use to retrieve the system directory path information (like Environment class in Win32 application), following are SystemDataPaths properties, To access propertices , we have to use the GetDefault( ) function , like

  1. SystemDataPaths.GetDefault().Fonts  
  2. public string Fonts { get; }  
  3. public string ProgramData { get; }  
  4. public string Public { get; }  
  5. public string PublicDesktop { get; }  
  6. public string PublicDocuments { get; }  
  7. public string PublicDownloads { get; }  
  8. public string PublicMusic { get; }  
  9. public string PublicPictures { get; }  
  10. public string PublicVideos { get; }  
  11. public string System { get; }  
  12. public string SystemArm { get; }  
  13. public string SystemHost { get; }  
  14. public string SystemX64 { get; }  
  15. public string SystemX86 { get; }  
  16. public string UserProfiles { get; }  
  17. public string Windows { get; }  
Ex

Retrieve complete systemdata path information,
  1. CreateSystemPath("Font Path : ", SystemDataPaths.GetDefault().Fonts),  
  2. CreateSystemPath("ProgramData : ", SystemDataPaths.GetDefault().ProgramData),  
  3. CreateSystemPath("Public : ", SystemDataPaths.GetDefault().Public),  
  4. CreateSystemPath("PublicDesktop : ", SystemDataPaths.GetDefault().PublicDesktop),  
  5. CreateSystemPath("PublicDocuments : ", SystemDataPaths.GetDefault().PublicDocuments),  
  6. CreateSystemPath("Public Downloads : ", SystemDataPaths.GetDefault().PublicDownloads),  
  7. CreateSystemPath("Public Music : ", SystemDataPaths.GetDefault().PublicMusic),  
  8. CreateSystemPath("Public Pictures : ", SystemDataPaths.GetDefault().PublicPictures),  
  9. CreateSystemPath("Public Videos : ", SystemDataPaths.GetDefault().PublicVideos),  
  10. CreateSystemPath("System : ", SystemDataPaths.GetDefault().System),  
  11. CreateSystemPath("System Arm: ", SystemDataPaths.GetDefault().SystemArm),  
  12. CreateSystemPath("SystemHost : ", SystemDataPaths.GetDefault().SystemHost),  
  13. CreateSystemPath("SystemX64 : ", SystemDataPaths.GetDefault().SystemX64),  
  14. CreateSystemPath("SystemX86 : ", SystemDataPaths.GetDefault().SystemX86),  
  15. CreateSystemPath("UserProfiles : ", SystemDataPaths.GetDefault().UserProfiles),  
  16. CreateSystemPath("Windows : ", SystemDataPaths.GetDefault().Windows)  

 

Output

Output 

UserDataPaths

UserDataPaths class is use to retrieve the user based directory path information. We can retrieve information based on current user(default) or other user information, for other user, we have to pass the user object as an argument

UserDataPaths properties

  1. public string CameraRoll { get; }  
  2. public string Cookies { get; }  
  3. public string Desktop { get; }  
  4. public string Documents { get; }  
  5. public string Downloads { get; }  
  6. public string Favorites { get; }  
  7. public string History { get; }  
  8. public string InternetCache { get; }  
  9. public string LocalAppData { get; }  
  10. public string LocalAppDataLow { get; }  
  11. public string Music { get; }  
  12. public string Pictures { get; }  
  13. public string Profile { get; }  
  14. public string Recent { get; }  
  15. public string RoamingAppData { get; }  
  16. public string SavedPictures { get; }  
  17. public string Screenshots { get; }  
  18. public string Templates { get; }  
  19. public string Videos { get; }  
retrieve the user based information call the GetForUser function.

 

ex
  1. var allUserInfo = await User.FindAllAsync();  
  2. foreach(var user in allUserInfo) {  
  3.     userPaths.FallSystemInfos.Add(CreateSystemPath("Desktop", UserDataPaths.GetForUser(user).Desktop));  
  4. }  
Retrieve the default user information use the GetDefault( ) function.
  1. UserDataPaths.GetDefault().Desktop  

Ex

Retrieve default User information,

  1. CreateSystemPath("Desktop : ", UserDataPaths.GetDefault().Desktop),  
  2. CreateSystemPath("LocalAppData", UserDataPaths.GetDefault().LocalAppData),  
  3. CreateSystemPath("CameraRoll", UserDataPaths.GetDefault().CameraRoll),  
  4. CreateSystemPath("Cookies", UserDataPaths.GetDefault().Cookies),  
  5. CreateSystemPath("Documents", UserDataPaths.GetDefault().Documents),  
  6. CreateSystemPath("Downloads", UserDataPaths.GetDefault().Downloads),  
  7. CreateSystemPath("Favorites", UserDataPaths.GetDefault().Favorites),  
  8. CreateSystemPath("History", UserDataPaths.GetDefault().History),  
  9. CreateSystemPath("InternetCache", UserDataPaths.GetDefault().InternetCache),  
  10. CreateSystemPath("LocalAppDataLow", UserDataPaths.GetDefault().LocalAppDataLow),  
  11. CreateSystemPath("Music", UserDataPaths.GetDefault().Music),  
  12. CreateSystemPath("Pictures", UserDataPaths.GetDefault().Pictures),  
  13. CreateSystemPath("Profile", UserDataPaths.GetDefault().Profile),  
  14. CreateSystemPath("Recent", UserDataPaths.GetDefault().Recent),  
  15. CreateSystemPath("RoamingAppData", UserDataPaths.GetDefault().RoamingAppData),  
  16. CreateSystemPath("SavedPictures", UserDataPaths.GetDefault().SavedPictures),  
  17. CreateSystemPath("Screenshots", UserDataPaths.GetDefault().Screenshots),  
  18. CreateSystemPath("Templates", UserDataPaths.GetDefault().Templates),  
  19. CreateSystemPath("Videos", UserDataPaths.GetDefault().Videos)  
Output



AppDataPaths

AppDataPaths class is use to retrieve the application installed directory information, This AppDataPaths class is provides two types of the installed information

  • Default
    Default function provides application installed based directory information

  • User
    Retrieve the path information based on the user, like one or more user login to the application, this function provides each user gets the different path)
  1. public string Cookies { get; }  
  2. public string Desktop { get; }  
  3. public string Documents { get; }  
  4. public string Favorites { get; }  
  5. public string History { get; }  
  6. public string InternetCache { get; }  
  7. public string LocalAppData { get; }  
  8. public string ProgramData { get; }  
  9. public string RoamingAppData { get; }  
Ex

Retrieve app based information
  1. CreateSystemPath("Desktop : ", AppDataPaths.GetDefault().Desktop),  
  2. CreateSystemPath("Cookies : ", AppDataPaths.GetDefault().Cookies),  
  3. CreateSystemPath("Documents : ", AppDataPaths.GetDefault().Documents),  
  4. CreateSystemPath("Favorites : ", AppDataPaths.GetDefault().Favorites),  
  5. CreateSystemPath("History : ", AppDataPaths.GetDefault().History),  
  6. CreateSystemPath("InternetCache : ", AppDataPaths.GetDefault().InternetCache),  
  7. CreateSystemPath("LocalAppData : ", AppDataPaths.GetDefault().LocalAppData),  
  8. CreateSystemPath("ProgramData : ", AppDataPaths.GetDefault().ProgramData),  
  9. CreateSystemPath("RoamingAppData : ", AppDataPaths.GetDefault().RoamingAppData)  
Output
 
Output 
Conclusion

I hope you can understand what is use of the SystemDataPaths, UserDataPaths, AppDataPaths  classes


Similar Articles