How do you access a Metro app's local storage in a desktop application in Windows 8?

Is there an API available for this in .Net? What about in the Windows API? If not, has anyone come up with some hackish-way to do this yet?

Upvotes: 5

Views: 2117

Answers (1)

Paulius Uza
Paulius Uza

Reputation: 489

Finding the local storage folder of a Windows 8 Style application

http://blog.falafel.com/Blogs/paul-tidwell/2012/08/27/finding-the-local-storage-folder-of-a-windows-8-style-application

The path to Windows 8 Style apps is as follows:

C:\Users\{username}\AppData\Local\Packages\Microsoft.BingSports_8wekyb3d8bbwe

There is a new Windows API which uses an internal and undisclosed algorithm to create a publisher hash, which when appended to the package name becomes the family name. Family name looks like {packagename}_{publisherhash}

If you wanted another desktop application or need to share this between some set of applications you can call the API via PowerShell cmdlet like so:

(Get-AppxPackage -AllUsers -Name  $name).PackageFamilyName

Write that to the registry and voila! Your application can use Environment.UserName and the path pattern above to easily find your appx local storage.

Upvotes: 3

Related Questions