[英]Sitecore: How to get the user profile item of currently logged in user
[英]How to check if the currently logged on user is using roaming profile?
如何检查当前用户是否正在使用漫游配置文件?
是否有任何.net框架库可以提供帮助?
我相信唯一的方法是调用Win32 shell函数GetProfileType 。 您需要使用P / Invoke进行调用,然后检查PT_ROAMING的pdwFlags参数的out值(值为2)。
我没有在pinvoke.net上看到这个函数的示例签名,但有这么简单的签名:
BOOL WINAPI GetProfileType(
DWORD *pdwFlags
);
创建一个并不难。
[DllImport("Userenv.dll", EntryPoint = "GetProfileType", SetLastError = true, CharSet = CharSet.Auto)]
public static extern bool GetProfileType(ref uint pdwflags);
[Flags]
enum Win32ProfileType : uint {
Local=0x00,
Temporary=0x01,
Roaming=0x02,
Mandatory=0x04
}
public void SomeTest()
{
uint type = 0;
if (GetProfileType(ref type)) {
//todo
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.