如何阅读在C#msExchMailboxSecurityDescriptor属性 [英] How to read msExchMailboxSecurityDescriptor attribute in C#
本文介绍了如何阅读在C#msExchMailboxSecurityDescriptor属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想读在公元所有的用户属性。
如何阅读 msExchMailboxSecurityDescriptor
在C#中的属性?
我用下面的code,但我得到了一个演员的错误。任何建议将受到欢迎。
DirectoryObjectSecurity OSEC =新ActiveDirectorySecurity();
oSec.SetSecurityDescriptorBinaryForm((byte []的)VAL);
字符串m_Value = oSec.GetSecurityDescriptorSddlForm(AccessControlSections.All);
返回m_Value;
解决方案
确定。我能弄明白。在code给出了下面的人感兴趣。我想微软已经推出了一些code样本,使人们不必打破他们的头。
SecurityDescriptor SD =(SecurityDescriptor)p_InputValue;
AccessControlList ACL =(AccessControlList)sd.DiscretionaryAcl;
字符串m_Trustee =;
字符串m_AccessMask =;
字符串m_AceType =;
字符串m_ReturnValue =;
的foreach(的AccessControlEntry王牌(IEnumerable的)ACL)
{
m_Trustee = m_Trustee +,+ ace.Trustee;
m_AccessMask = m_AccessMask +,+ ace.AccessMask.ToString();
m_AceType = m_AceType +,+ ace.AceType.ToString();
}
m_Return值=受托人+ m_Trustee ++AccessMask:+ m_AccessMask +AceType:+ m_AceType
返回m_ReturnValue
I am trying to read all the user attributes in AD.
How to read msExchMailboxSecurityDescriptor
attribute in C# ?
I used the following code but I got a cast error. Any suggestions would be welcome.
DirectoryObjectSecurity oSec = new ActiveDirectorySecurity();
oSec.SetSecurityDescriptorBinaryForm((byte[])val);
String m_Value = oSec.GetSecurityDescriptorSddlForm(AccessControlSections.All);
return m_Value;
解决方案
Ok. I was able to figure it out. The code is given below for anyone interested. I wish Microsoft had put out some code samples so that people do not have to break their heads.
SecurityDescriptor sd = (SecurityDescriptor) p_InputValue;
AccessControlList acl = (AccessControlList)sd.DiscretionaryAcl;
String m_Trustee = "";
String m_AccessMask = "";
String m_AceType = "";
String m_ReturnValue="";
foreach (AccessControlEntry ace in (IEnumerable)acl)
{
m_Trustee = m_Trustee + "," + ace.Trustee;
m_AccessMask = m_AccessMask + "," + ace.AccessMask.ToString();
m_AceType = m_AceType + "," +ace.AceType.ToString();
}
m_Return value="Trustee: " + m_Trustee + " " + "AccessMask: " + m_AccessMask + "AceType: " + m_AceType
return m_ReturnValue
这篇关于如何阅读在C#msExchMailboxSecurityDescriptor属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文