其他分享
首页 > 其他分享> > CodeGo.net>如何设置accountExpires

CodeGo.net>如何设置accountExpires

作者:互联网

dirEntry.Properties["userAccountControl"].Value = val & ~0x2; //enable user
//above line no error but below line get error
dirEntry.Properties["accountExpires"].Value = DateTime.UtcNow.AddDays(1).ToFileTimeUtc();

The error thrown is errMsg =
“System.Runtime.InteropServices.COMException (0x80004005): Unspecified
error\r\n\r\n at
System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.PutEx(Int32
lnControlCode, String bstrName, Object vProp)\r\n at
System.DirectoryServices.PropertyValueColl…

请指教.如果是权限问题,我将在第一行出现错误……在前提条件下(不是Azure)谢谢

解决方法:

对于那些来这里遇到同样问题的人,此问题已得到解决. . .

Convert.ToString((Int64)DateTime.UtcNow.AddDays(1).ToFileTimeUtc())

参见this thread进行更详细的讨论.

标签:active-directory,asp-net,c,net
来源: https://codeday.me/bug/20191108/2008867.html