I found this nice article of how to add a user tile image via code:
http://joco.name/2010/12/06/i-discovered-the-new-windows-user-tile-api/
This is also explained in depth here: http://msitpros.com/?p=1036
I have problems with doing this in Windows Server 2012. Whenever I run the code:
using System;
using System.Runtime.InteropServices;
namespace FejesJoco
{
class Program
{
[DllImport("shell32.dll", EntryPoint = "#262", CharSet = CharSet.Unicode, PreserveSig = false)]
public static extern void SetUserTile(string username, int whatever, string picpath);
[STAThread]
static void Main(string[] args)
{
SetUserTile(args[0], 0, args[1]);
}
}
}
However it doesn't do anything.
There is an example from Microsoft using an App to get the current profile image: http://code.msdn.microsoft.com/windowsapps/Account-picture-name-sample-912baff1 , but I am also not able to set the image that way. The only way which worked for me is to install the Desktop experience Feature and set the image manually via PC Settings.
Can anyone get this to work and add a user tile image via code?