Search code examples
c#.netsilverlightsilverlight-oobelevated-privileges

Can't get My Documents path in Silverlight 4.0


For some reason this line of code...

var dirInfo = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

...returns an empty string on my dev machine.

I'm running OOB and with elevated trust on Win7.

I don't honestly know quite where to start on this. Can anyone shed any light?

Thanks in advance,


Solution

  • Joy of joys...

    The problem was down to my working from home on a machine which uses roaming profiles! Should've guessed that really.

    The fix was simple enough.

    RegEdit -> HKCU -> Software -> Microsoft -> Windows -> Current Version -> Explorer -> User Shell Folders -> Personal was pointing to a remote (unavailable) path. Just changed this to a local path and all worked well.